argotorg / argotorg/solidity

[Yul optimizer] ICE because invalid code is produced during optimization using custom optimization steps

Open
#14,693 4 comments 0 reactions 0 assignees View on GitHub
bug :bug: medium effort medium impact
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.