aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-03-11 23:14:21 +0800
committerchriseth <c@ethdev.com>2016-03-11 23:14:48 +0800
commit3b9969baaa535505c0d97d4d616997ff29774350 (patch)
tree0fd64f8856d7ab993d9ddf28d77b8e17dc48586b /test
parentee0ba31c2b6a2cc40bf12198e84f8bb4cd64414a (diff)
downloaddexon-solidity-3b9969baaa535505c0d97d4d616997ff29774350.tar
dexon-solidity-3b9969baaa535505c0d97d4d616997ff29774350.tar.gz
dexon-solidity-3b9969baaa535505c0d97d4d616997ff29774350.tar.bz2
dexon-solidity-3b9969baaa535505c0d97d4d616997ff29774350.tar.lz
dexon-solidity-3b9969baaa535505c0d97d4d616997ff29774350.tar.xz
dexon-solidity-3b9969baaa535505c0d97d4d616997ff29774350.tar.zst
dexon-solidity-3b9969baaa535505c0d97d4d616997ff29774350.zip
Test for optimizer bug caused by not incrementing the sequence counter.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityOptimizer.cpp14
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;