Combining --optimize with --no-optimize-yul causes solc to crash
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
## Environment
- Compiler version: solc 0.8.31
## Steps to Reproduce
Compile the following code using the command `solc a.sol --bin --optimize --no-optimize-yul`
```
contract C {
struct A { string a; }
function f() public returns(A memory) {
A memory t;
return t;
}
}
```
Output:
```
Internal compiler error:
/solidity/libsolidity/interface/CompilerStack.cpp(1796): Throw in function std::string solidity::frontend::CompilerStack::createMetadata(const Contract&, bool) const
Dynamic exception type: boost::wrapexcept
std::exception::what: Solidity assertion failed
[solidity::util::tag_comment*] = Solidity assertion failed
```
Contributor guide
Research direction
Start by reproducing the crash with solc 0.8.31 using the command and contract in the issue. Then inspect CompilerStack.cpp around line 1796, where the assertion is reported, and trace the metadata path for --optimize combined with --no-optimize-yul. Done means the reproduction compiles without an internal compiler error and a regression check covers the command.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100