You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not a bug, but rather an issue. In the following example, it is known at compile time that the else branch is unreachable. If the loop is commented out, the legacy pipeline optimizer successfully eliminates the dead code; however, with the loop in place, the optimizer fails to do so.
// SPDX-License-Identifier: UNLICENSEDpragma solidity>=0.8.0;
contractTest {
function foo() externalpayablereturns (uint256) {
if (true) {
return0xbeef;
} else {
for (uint256 i; i <1; ++i) {}
return0xdead;
}
}
}
Assembly listing
Output of the command: solc --optimize --optimize-runs=250 --no-cbor-metadata --asm Test.sol:
In the listing above the tags tag_10 and tag_11 are unreachable. However, tag_10 (the loop) references both itself and tag_11, which likely prevents both tags from being removed by the legacy pipeline.
Environment
Compiler version: 0.8.24-0.8.29
Compilation pipeline (legacy, IR, EOF): legacy
Target EVM version (as per compiler settings): default
Description
Not a bug, but rather an issue. In the following example, it is known at compile time that the
else
branch is unreachable. If the loop is commented out, the legacy pipeline optimizer successfully eliminates the dead code; however, with the loop in place, the optimizer fails to do so.Assembly listing
Output of the command:
solc --optimize --optimize-runs=250 --no-cbor-metadata --asm Test.sol
:In the listing above the tags
tag_10
andtag_11
are unreachable. However,tag_10
(the loop) references both itself andtag_11
, which likely prevents both tags from being removed by the legacy pipeline.Environment
Steps to Reproduce
Compile the example given at the beginning of the issue with following command:
The text was updated successfully, but these errors were encountered: