Description
The program below compiles without problem using --via-ir but throws an assertion failure when using the experimental --via-ssa-cfg.
Environment
- Compiler version: 0.8.35+commit.47b9dedd
- Compilation pipeline (legacy, IR, EOF): via SSA CFG
- Target EVM version (as per compiler settings): -
- Framework/IDE (e.g. Foundry, Hardhat, Remix): CLI
- EVM execution environment / backend / blockchain client: -
- Operating system: macOS & Linux
Steps to Reproduce
pragma solidity ^0.8.1;
contract C {
function f(
uint256,
uint256,
int256,
uint256 a13,
int256
) external returns (bool) {
uint256 a15;
uint256 a16;
uint256 a17;
uint256 a18;
bool a19;
bool a20;
bool a21;
bool a22;
bool a23;
while (
(((((
(((1 * 0) +
(((a13 - (a15 | 0)) &
(((((a13 - (1 & 1)) + (0 - a16)) - 0) ^ 0) - 0)) * 1)) >
((uint256(block.gaslimit) - (0 + (1 - 0))) + 0))
? true
: false
) || a19) ||
((false ||
((((
((((a13 - (0 | 0)) &
((0 ^ (((a13 - a17) + (1 - 0)) - (0 / 1))) - 0)) +
a15) >
((((0 | (uint256(block.gaslimit) - 0)) - (1 - 0)) +
1) / a18))
? true
: false
) ||
(((((uint256(block.gaslimit) - 1) + 1) &
((uint256(block.gaslimit) - 1) + 1)) - 0) ==
((((a13 + 0) - 1) & (a13 - 1)) + 1))) && true) &&
a20)) || false)) &&
(a21 ||
((false ||
((((
((((a13 - (0 | 1)) &
((0 ^ (((a13 - 1) + (1 - 0)) - (1 / 1))) - 0)) +
1) >
((((0 | (uint256(block.gaslimit) - 0)) -
(1 - 0)) + 1) / 1))
? true
: false
) ||
(((((uint256(block.gaslimit) - 1) + 1) &
((uint256(block.gaslimit) - 1) + 1)) - 0) ==
(((a13 - 1) & ((a13 / 1) - 1)) + 1))) &&
true) && a22)) || false))) &&
(((
(((0 | a13) >
((((0 |
(((uint256(block.gaslimit) - 1) + 1) &
uint256(block.gaslimit))) - ((1 & 1) + 1)) +
1) + 1)) ||
(
!(
!((((((uint256(block.gaslimit) -
((1 + ((1 * 1) - 1)) + 1)) |
(uint256(block.gaslimit) -
((1 + ((1 * 1) - 1)) + (1 + 0)))) +
(1 * (((1 - 1) ^ 0) + 1))) + 1) &
((((uint256(block.gaslimit) -
((1 + ((1 * 1) - 1)) + 1)) |
((uint256(block.gaslimit) -
(1 + ((1 * 1) - 1))) - 1)) +
(1 * (((1 - 1) ^ 0) + 1))) + 1)) == a13)
)
))
? true
: false
) ||
((false ||
((((
((((a13 - (0 | 1)) &
((uint256(0) ^
(((a13 - 1) + (uint256(1) - 0)) - 1)) -
0)) + 1) >
((((0 | (uint256(block.gaslimit) - 0)) -
(1 - 0)) + 1) / 1))
? true
: false
) ||
((((uint256(block.gaslimit) - 1) + 1) &
((uint256(block.gaslimit) - 1) + 1)) ==
(((a13 - 1) & (a13 - 1)) + 1))) && true) &&
(
((a13 >
((((0 ^
(((uint256(block.gaslimit) &
((uint256(block.gaslimit) - 1) +
1)) - 1) - 1)) + 1) + 0) +
1)) ||
(((((1 * uint256(block.gaslimit)) - 1) -
(1 * 1)) + ((1 * ((1 - 1) + 1)) + 1)) ==
a13))
? true
: false
))) || false)) && true))
) {}
if (a23) {}
}
}
CLI command
solc contract.sol --via-ir --experimental --via-ssa-cfg --bin-runtime
Output
/solidity/libyul/backends/evm/ssa/StackUtils.cpp(134): Throw in function auto solidity::yul::ssa::findOptimalTargetSize(const StackData &, const StackData &, const StackSlotLiveness &, const bool, const bool)::(anonymous class)::operator()(const std::size_t) const
Dynamic exception type: boost::wrapexcept<solidity::yul::YulAssertion>
std::exception::what: Yul assertion failed
[solidity::util::tag_comment*] = Yul assertion failed
Expected Behavior
Should compile without issue.
Description
The program below compiles without problem using
--via-irbut throws an assertion failure when using the experimental--via-ssa-cfg.Environment
Steps to Reproduce
CLI command
Output
Expected Behavior
Should compile without issue.