From 14cdb76e4b16376484dd33ce9a050925c663dabc Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 7 Jun 2022 12:42:50 +0200 Subject: [PATCH] Add failing test --- .../optimize_memory_store_multi_block.sol | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/libsolidity/semanticTests/inlineAssembly/optimize_memory_store_multi_block.sol diff --git a/test/libsolidity/semanticTests/inlineAssembly/optimize_memory_store_multi_block.sol b/test/libsolidity/semanticTests/inlineAssembly/optimize_memory_store_multi_block.sol new file mode 100644 index 000000000..023d178a9 --- /dev/null +++ b/test/libsolidity/semanticTests/inlineAssembly/optimize_memory_store_multi_block.sol @@ -0,0 +1,23 @@ +contract Test { + uint256 x; + + function test() public returns (uint256) { + uint256 a = myGetX(); + x = 5; + uint256 b = myGetX(); + assembly { + log0(0, 64) + } + return a + b + myGetX(); + } + + function myGetX() internal view returns (uint256) { + assembly { + mstore(1, 0x123456789abcdef) + } + return x; + } +} +// ---- +// test() -> 10 +// ~ emit : 0x0123456789abcd, 0xef00000000000000000000000000000000000000000000000000000000000000