diff options
author | chriseth <c@ethdev.com> | 2016-11-22 21:55:09 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-11-22 21:58:24 +0800 |
commit | 7fb7d5ae39a4bd5e0852db1fe5d21fdd4a0fd80f (patch) | |
tree | 2bf77027e3090c6bb969e8c0aa9d079ddcfc054b /test/libsolidity/SolidityOptimizer.cpp | |
parent | aa48008cc72c6f44db2cbd30a1bee522be67ecd8 (diff) | |
download | dexon-solidity-7fb7d5ae39a4bd5e0852db1fe5d21fdd4a0fd80f.tar.gz dexon-solidity-7fb7d5ae39a4bd5e0852db1fe5d21fdd4a0fd80f.tar.zst dexon-solidity-7fb7d5ae39a4bd5e0852db1fe5d21fdd4a0fd80f.zip |
Optimizer: Clear state for JUMPDESTs.
Diffstat (limited to 'test/libsolidity/SolidityOptimizer.cpp')
-rw-r--r-- | test/libsolidity/SolidityOptimizer.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
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() } |