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
If a Yul function with the same name is defined again with different parameters and/or return parameters in a completely different scope in inline assembly, the compiler throws an ICE.
It happens only with the new code generator and I did not manage to reproduce it with optimizer enabled.
It's probably related to #12090, but this one can be triggered using inline assembly rather than pure Yul. The solution should also probably be different - the compiler can just give these functions different names internally instead of completely disabling named labels (which is the solution in #12139).
Steps to Reproduce
contract.sol:
contractC {
function f() external {
assembly {
{
function x() -> a {}
}
{
function x() {}
}
}
}
}
solc --bin --experimental-via-ir contract.sol
Exception during compilation: /solidity/libevmasm/Assembly.cpp(350): Throw in function solidity::evmasm::AssemblyItem solidity::evmasm::Assembly::namedTag(const string&, size_t, size_t, std::optional<long unsigned int>)
Dynamic exception type: boost::wrapexcept<solidity::evmasm::AssemblyException>
std::exception::what:
[solidity::util::tag_comment*] =
The result is the same even if the functions are defined in separate assembly blocks, even if these blocks are inside different Solidity functions:
contractC {
function f() external {
assembly {
function x() -> a {}
}
}
function g() external {
assembly {
function x() {}
}
}
}
Note that, unlike in #12090, just giving functions the same name is not enough to trigger this. For example this compiles fine:
contractC {
function f() external {
assembly {
function x() { mstore(0, 0) }
}
}
function g() external {
assembly {
function x() { mstore(1, 1) }
}
}
}
Environment
Compiler version: 0.8.9
The text was updated successfully, but these errors were encountered:
cameel
changed the title
ICE when defining multiple Yul functions with the same name but different arguments/returns in different inline assembly blocks
ICE when defining multiple Yul functions with the same name but different arguments/returns in inline assembly
Oct 17, 2021
Description
If a Yul function with the same name is defined again with different parameters and/or return parameters in a completely different scope in inline assembly, the compiler throws an ICE.
It happens only with the new code generator and I did not manage to reproduce it with optimizer enabled.
It's probably related to #12090, but this one can be triggered using inline assembly rather than pure Yul. The solution should also probably be different - the compiler can just give these functions different names internally instead of completely disabling named labels (which is the solution in #12139).
Steps to Reproduce
contract.sol
:The result is the same even if the functions are defined in separate assembly blocks, even if these blocks are inside different Solidity functions:
Note that, unlike in #12090, just giving functions the same name is not enough to trigger this. For example this compiles fine:
Environment
The text was updated successfully, but these errors were encountered: