Open Jack-Clark opened 1 year ago
Slightly simplified repro:
contract C {
uint128 u128;
int8 a;
int8 b;
int8 c;
bool x = (b = b >> 0) == int8(x ? 0 : 0);
int8 d = d << u128;
int8 e = e << u128;
int8 f = (a = a << u128);
int8 g = (c &= (a = a << u128));
int8 h = a | (c = c >> 0) << (x ? u128 : u128);
}
I couldn't get it any simpler than that. Haven't verified it actually runs into OOM but it does keep running for a long time. It keeps eating more and more memory, but much more slowly than the original repro.
It looks like some pathological case in Yul optimizer.
It is only reproducible on 0.8.18+. Below that it finishes fast. The only thing in the changelog that looks related is this:
- Optimizer: Added optimization rule
and(shl(X, Y), shl(X, Z)) => shl(X, and(Y, Z))
.
Description
Given the following contract:
I get an out of memory error when running
solc --bin --optimize --via-ir Test.sol
. I can't reproduce the issue with either the--optimize
or--via-ir
flags set separately, or with both omitted. I have run this on two machines both with 32GB RAM and both OOM. Here is the dmesg output from one machine:Environment