diff --git a/libyul/backends/evm/EVMDialect.cpp b/libyul/backends/evm/EVMDialect.cpp index 4115df4e1..3274f440f 100644 --- a/libyul/backends/evm/EVMDialect.cpp +++ b/libyul/backends/evm/EVMDialect.cpp @@ -266,10 +266,15 @@ EVMDialectTyped::EVMDialectTyped(langutil::EVMVersion _evmVersion, bool _objectA BuiltinContext&, std::function _visitArguments ) { - // TODO Should a value larger than 1 be invalid? + // A value larger than 1 causes an invalid instruction. _visitArguments(); - _assembly.appendInstruction(evmasm::Instruction::ISZERO); - _assembly.appendInstruction(evmasm::Instruction::ISZERO); + _assembly.appendConstant(2); + _assembly.appendInstruction(evmasm::Instruction::DUP2); + _assembly.appendInstruction(evmasm::Instruction::LT); + AbstractAssembly::LabelID inRange = _assembly.newLabelId(); + _assembly.appendJumpToIf(inRange); + _assembly.appendInstruction(evmasm::Instruction::INVALID); + _assembly.appendLabel(inRange); })); m_functions["u256_to_bool"_yulstring].returns = {"bool"_yulstring}; }