diff --git a/test/libyul/yulInterpreterTests/access_large_memory_offsets.yul b/test/libyul/yulInterpreterTests/access_large_memory_offsets.yul new file mode 100644 index 000000000..483220bc1 --- /dev/null +++ b/test/libyul/yulInterpreterTests/access_large_memory_offsets.yul @@ -0,0 +1,14 @@ +{ + mstore(0, 7) + sstore(0, mload(0)) + mstore(sub(0, 1), sub(0, 1)) + sstore(1, mload(sub(0, 1))) +} +// ---- +// Trace: +// Memory dump: +// 0: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff07 +// FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0: 00000000000000000000000000000000000000000000000000000000000000ff +// Storage dump: +// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000007 +// 0000000000000000000000000000000000000000000000000000000000000001: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff diff --git a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp index 70e163bf4..45584a19f 100644 --- a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp +++ b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp @@ -248,16 +248,15 @@ u256 EVMInstructionInterpreter::eval( return m_state.gaslimit; // --------------- memory / storage / logs --------------- case Instruction::MLOAD: - if (accessMemory(arg[0], 0x20)) - return readMemoryWord(arg[0]); - return 0; + accessMemory(arg[0], 0x20); + return readMemoryWord(arg[0]); case Instruction::MSTORE: - if (accessMemory(arg[0], 0x20)) - writeMemoryWord(arg[0], arg[1]); + accessMemory(arg[0], 0x20); + writeMemoryWord(arg[0], arg[1]); return 0; case Instruction::MSTORE8: - if (accessMemory(arg[0], 1)) - m_state.memory[arg[0]] = uint8_t(arg[1] & 0xff); + accessMemory(arg[0], 1); + m_state.memory[arg[0]] = uint8_t(arg[1] & 0xff); return 0; case Instruction::SLOAD: return m_state.storage[h256(arg[0])];