From 7fb7d5ae39a4bd5e0852db1fe5d21fdd4a0fd80f Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 22 Nov 2016 14:55:09 +0100 Subject: Optimizer: Clear state for JUMPDESTs. --- test/libsolidity/SolidityOptimizer.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test/libsolidity/SolidityOptimizer.cpp') diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index 4991cf24..017fc0e9 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -1246,6 +1246,26 @@ BOOST_AUTO_TEST_CASE(dead_code_elimination_across_assemblies) compareVersions("test()"); } +BOOST_AUTO_TEST_CASE(invalid_state_at_control_flow_join) +{ + char const* sourceCode = R"( + contract Test { + uint256 public totalSupply = 100; + function f() returns (uint r) { + if (false) + r = totalSupply; + totalSupply -= 10; + } + function test() returns (uint) { + f(); + return this.totalSupply(); + } + } + )"; + compileBothVersions(sourceCode); + compareVersions("test()"); +} + BOOST_AUTO_TEST_SUITE_END() } -- cgit