diff options
Diffstat (limited to 'test/libsolidity')
-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() } |