diff options
author | chriseth <c@ethdev.com> | 2016-03-11 23:27:15 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-03-11 23:27:15 +0800 |
commit | 172beaec5e3c3b86926d0b710af9861b4b00c5eb (patch) | |
tree | 0fd64f8856d7ab993d9ddf28d77b8e17dc48586b | |
parent | ee0ba31c2b6a2cc40bf12198e84f8bb4cd64414a (diff) | |
parent | 3b9969baaa535505c0d97d4d616997ff29774350 (diff) | |
download | dexon-solidity-172beaec5e3c3b86926d0b710af9861b4b00c5eb.tar.gz dexon-solidity-172beaec5e3c3b86926d0b710af9861b4b00c5eb.tar.zst dexon-solidity-172beaec5e3c3b86926d0b710af9861b4b00c5eb.zip |
Merge pull request #426 from chriseth/optfix
Test for optimizer bug caused by not incrementing the sequence counter.
-rw-r--r-- | test/libsolidity/SolidityOptimizer.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index 2f1eb04e..6aa90973 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -390,6 +390,20 @@ BOOST_AUTO_TEST_CASE(incorrect_storage_access_bug) compareVersions("f()"); } +BOOST_AUTO_TEST_CASE(sequence_number_for_calls) +{ + // This is a test for a bug that was present because we did not increment the sequence + // number for CALLs - CALLs can read and write from memory (and DELEGATECALLs can do the same + // to storage), so the sequence number should be incremented. + char const* sourceCode = R"( + contract test { + function f(string a, string b) returns (bool) { return sha256(a) == sha256(b); } + } + )"; + compileBothVersions(sourceCode); + compareVersions("f(string,string)", 0x40, 0x80, 3, "abc", 3, "def"); +} + BOOST_AUTO_TEST_CASE(cse_intermediate_swap) { eth::KnownState state; |