diff -Nru solc-0.4.5/Changelog.md solc-0.4.6/Changelog.md --- solc-0.4.5/Changelog.md 2016-11-21 11:06:04.000000000 +0000 +++ solc-0.4.6/Changelog.md 2016-11-22 14:38:41.000000000 +0000 @@ -1,3 +1,8 @@ +### 0.4.6 (2016-11-22) + +Bugfixes: + * Optimizer: Knowledge about state was not correctly cleared for JUMPDESTs + ### 0.4.5 (2016-11-21) Features: diff -Nru solc-0.4.5/CMakeLists.txt solc-0.4.6/CMakeLists.txt --- solc-0.4.5/CMakeLists.txt 2016-11-21 11:06:04.000000000 +0000 +++ solc-0.4.6/CMakeLists.txt 2016-11-22 14:38:41.000000000 +0000 @@ -8,7 +8,7 @@ eth_policy() # project name and version should be set after cmake_policy CMP0048 -set(PROJECT_VERSION "0.4.5") +set(PROJECT_VERSION "0.4.6") project(solidity VERSION ${PROJECT_VERSION}) # Let's find our dependencies diff -Nru solc-0.4.5/commit_hash.txt solc-0.4.6/commit_hash.txt --- solc-0.4.5/commit_hash.txt 2016-11-21 11:06:07.000000000 +0000 +++ solc-0.4.6/commit_hash.txt 2016-11-22 14:38:46.000000000 +0000 @@ -1 +1 @@ -b318366e +2dabbdf0 diff -Nru solc-0.4.5/debian/changelog solc-0.4.6/debian/changelog --- solc-0.4.5/debian/changelog 2016-11-21 11:06:47.000000000 +0000 +++ solc-0.4.6/debian/changelog 2016-11-22 14:39:44.000000000 +0000 @@ -1,8 +1,8 @@ -solc (1:0.4.5-0ubuntu1~wily) UNRELEASED; urgency=medium +solc (1:0.4.6-0ubuntu1~wily) UNRELEASED; urgency=medium - * git build of b318366e + * git build of 2dabbdf0 - -- christian Mon, 21 Nov 2016 12:06:47 +0100 + -- christian Tue, 22 Nov 2016 15:39:44 +0100 solc (0.0.1-0ubuntu1) saucy; urgency=low diff -Nru solc-0.4.5/docs/conf.py solc-0.4.6/docs/conf.py --- solc-0.4.5/docs/conf.py 2016-11-21 11:06:04.000000000 +0000 +++ solc-0.4.6/docs/conf.py 2016-11-22 14:38:41.000000000 +0000 @@ -56,9 +56,9 @@ # built documents. # # The short X.Y version. -version = '0.4.5' +version = '0.4.6' # The full version, including alpha/beta/rc tags. -release = '0.4.5-develop' +release = '0.4.6-develop' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff -Nru solc-0.4.5/libevmasm/Assembly.cpp solc-0.4.6/libevmasm/Assembly.cpp --- solc-0.4.5/libevmasm/Assembly.cpp 2016-11-21 11:06:04.000000000 +0000 +++ solc-0.4.6/libevmasm/Assembly.cpp 2016-11-22 14:38:41.000000000 +0000 @@ -360,46 +360,35 @@ auto iter = m_items.begin(); while (iter != m_items.end()) { - auto end = iter; - while (end != m_items.end()) - if (SemanticInformation::altersControlFlow(*end++)) - break; - KnownState emptyState; CommonSubexpressionEliminator eliminator(emptyState); - auto blockIter = iter; - auto const blockEnd = end; - while (blockIter < blockEnd) + auto orig = iter; + iter = eliminator.feedItems(iter, m_items.end()); + bool shouldReplace = false; + AssemblyItems optimisedChunk; + try + { + optimisedChunk = eliminator.getOptimizedItems(); + shouldReplace = (optimisedChunk.size() < size_t(iter - orig)); + } + catch (StackTooDeepException const&) { - auto orig = blockIter; - blockIter = eliminator.feedItems(blockIter, blockEnd); - bool shouldReplace = false; - AssemblyItems optimisedChunk; - try - { - optimisedChunk = eliminator.getOptimizedItems(); - shouldReplace = (optimisedChunk.size() < size_t(blockIter - orig)); - } - catch (StackTooDeepException const&) - { - // This might happen if the opcode reconstruction is not as efficient - // as the hand-crafted code. - } - catch (ItemNotAvailableException const&) - { - // This might happen if e.g. associativity and commutativity rules - // reorganise the expression tree, but not all leaves are available. - } + // This might happen if the opcode reconstruction is not as efficient + // as the hand-crafted code. + } + catch (ItemNotAvailableException const&) + { + // This might happen if e.g. associativity and commutativity rules + // reorganise the expression tree, but not all leaves are available. + } - if (shouldReplace) - { - count++; - optimisedItems += optimisedChunk; - } - else - copy(orig, blockIter, back_inserter(optimisedItems)); + if (shouldReplace) + { + count++; + optimisedItems += optimisedChunk; } - iter = end; + else + copy(orig, iter, back_inserter(optimisedItems)); } if (optimisedItems.size() < m_items.size()) { diff -Nru solc-0.4.5/test/libsolidity/SolidityOptimizer.cpp solc-0.4.6/test/libsolidity/SolidityOptimizer.cpp --- solc-0.4.5/test/libsolidity/SolidityOptimizer.cpp 2016-11-21 11:06:04.000000000 +0000 +++ solc-0.4.6/test/libsolidity/SolidityOptimizer.cpp 2016-11-22 14:38:41.000000000 +0000 @@ -1246,6 +1246,26 @@ 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() }