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
The following code triggers an SMT logic error. This appears to be due to solc treating function () external returns (uint256)_array_tuple as distinct from function () view external returns (uint256)_array_tuple. However, the code compiles successfully, indicating that solc's type checking deems it valid.
contractC {
function() externalreturns(uint)[1] a;
function b() externalviewreturns(uint) {
return1;
}
function test() publicreturns(uint) {
a = [this.b];
returna[0]();
}
}
Compile: solc --model-checker-engine all a.sol
Output:
SMT logic error:
/solidity/libsmtutil/Z3Interface.cpp(270): Throw in function z3::expr solidity::smtutil::Z3Interface::toZ3Expr(const solidity::smtutil::Expression&)
Dynamic exception type: boost::wrapexcept<solidity::smtutil::SMTLogicError>
std::exception::what: Sorts |function () external returns (uint256)_array_tuple| and |function () view external returns (uint256)_array_tuple| are incompatible
[solidity::util::tag_comment*] = Sorts |function () external returns (uint256)_array_tuple| and |function () view external returns (uint256)_array_tuple| are incompatible
The same issue occurs if function b is defined as a pure function.
Environment
Compiler version: 0.8.25
The text was updated successfully, but these errors were encountered:
lum7na
changed the title
The SMTChecker encounters issues with type inference for arrays of functions
SMTChecker fails to handle arrays of pure/view functions
Apr 8, 2024
Description
The following code triggers an
SMT logic error
. This appears to be due tosolc
treatingfunction () external returns (uint256)_array_tuple
as distinct fromfunction () view external returns (uint256)_array_tuple
. However, the code compiles successfully, indicating thatsolc
's type checking deems it valid.Compile:
solc --model-checker-engine all a.sol
Output:
The same issue occurs if function
b
is defined as apure
function.Environment
The text was updated successfully, but these errors were encountered: