aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-03-12 01:09:35 +0800
committerchriseth <c@ethdev.com>2015-03-17 01:07:14 +0800
commit10be65f269390257984eef1d04227b88578a85bc (patch)
treea74ea94cd1049177237f52ce89f8799bab1b9606
parent7ad027055d35df1475b4e3cabf50da1f93faa679 (diff)
downloaddexon-solidity-10be65f269390257984eef1d04227b88578a85bc.tar
dexon-solidity-10be65f269390257984eef1d04227b88578a85bc.tar.gz
dexon-solidity-10be65f269390257984eef1d04227b88578a85bc.tar.bz2
dexon-solidity-10be65f269390257984eef1d04227b88578a85bc.tar.lz
dexon-solidity-10be65f269390257984eef1d04227b88578a85bc.tar.xz
dexon-solidity-10be65f269390257984eef1d04227b88578a85bc.tar.zst
dexon-solidity-10be65f269390257984eef1d04227b88578a85bc.zip
Enlarge storage references to two stack slots.
-rw-r--r--SolidityEndToEndTest.cpp23
-rw-r--r--SolidityOptimizer.cpp2
2 files changed, 23 insertions, 2 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp
index 8ccf9b3f..de6f43b7 100644
--- a/SolidityEndToEndTest.cpp
+++ b/SolidityEndToEndTest.cpp
@@ -534,6 +534,27 @@ BOOST_AUTO_TEST_CASE(empty_string_on_stack)
BOOST_CHECK(callContractFunction("run(bytes0,uint8)", string(), byte(0x02)) == encodeArgs(0x2, string(""), string("abc\0")));
}
+BOOST_AUTO_TEST_CASE(inc_dec_operators)
+{
+ char const* sourceCode = R"(
+ contract test {
+ uint8 x;
+ uint v;
+ function f() returns (uint r) {
+ uint a = 6;
+ r = a;
+ r += (a++) * 0x10;
+ r += (++a) * 0x100;
+ v = 3;
+ r += (v++) * 0x1000;
+ r += (++v) * 0x10000;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ BOOST_CHECK(callContractFunction("f()") == encodeArgs(0x53866));
+}
+
BOOST_AUTO_TEST_CASE(state_smoke_test)
{
char const* sourceCode = "contract test {\n"
@@ -2502,7 +2523,7 @@ BOOST_AUTO_TEST_CASE(struct_copy)
contract c {
struct Nested { uint x; uint y; }
struct Struct { uint a; mapping(uint => Struct) b; Nested nested; uint c; }
- mapping(uint => Struct) public data;
+ mapping(uint => Struct) data;
function set(uint k) returns (bool) {
data[k].a = 1;
data[k].nested.x = 3;
diff --git a/SolidityOptimizer.cpp b/SolidityOptimizer.cpp
index 41ec1f90..161d1f89 100644
--- a/SolidityOptimizer.cpp
+++ b/SolidityOptimizer.cpp
@@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE(unused_expressions)
data;
}
})";
- compileBothVersions(33, sourceCode);
+ compileBothVersions(29, sourceCode);
compareVersions("f()");
}