[Yul optimizer] ICE because invalid code is produced during optimization using custom optimization steps
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
```
{
let a
for { } lt(a, 4) { a := add(a, 2) }
{
mstore(0, a)
a := add(a, 1)
}
}
```
throws
https://github.com/ethereum/solidity/blob/58811f134ac369b20c2ec1120907321edf08fff1/libyul/AsmAnalysis.cpp#L97
Repro
```
solc --strict-assembly --optimize --yul-optimizations 'ams' test.yul
```
Contributor guide
Research direction
Reproduce the failure with the supplied test.yul input and the `solc --strict-assembly --optimize --yul-optimizations 'ams' test.yul` command. Start at the linked line in libyul/AsmAnalysis.cpp and trace how the custom optimization steps produce invalid code. Done means the reproduction no longer triggers the internal compiler error or emits invalid optimized code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100