aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-06-23 23:27:57 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-06-28 23:55:49 +0800
commit46caff4597a1cafbafe0cbcc9fb7e7478dd2a0e3 (patch)
tree9a57fbd2dfd9870f5da3f8debf0db3f98e86db42 /test/libsolidity/SolidityEndToEndTest.cpp
parent79d13366874c432c2f8f2adf3cd8cc00638c6a98 (diff)
downloaddexon-solidity-46caff4597a1cafbafe0cbcc9fb7e7478dd2a0e3.tar.gz
dexon-solidity-46caff4597a1cafbafe0cbcc9fb7e7478dd2a0e3.tar.zst
dexon-solidity-46caff4597a1cafbafe0cbcc9fb7e7478dd2a0e3.zip
Test for negative stack height.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index ffee5e36..da725581 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -9501,6 +9501,27 @@ BOOST_AUTO_TEST_CASE(revert)
BOOST_CHECK(callContractFunction("a()") == encodeArgs(u256(42)));
}
+BOOST_AUTO_TEST_CASE(negative_stack_height)
+{
+ // This code was causing negative stack height during code generation
+ // because the stack height was not adjusted at the beginning of functions.
+ char const* sourceCode = R"(
+ contract C {
+ mapping(uint => Invoice) public invoices;
+ struct Invoice {
+ uint AID;
+ bool Aboola;
+ bool Aboolc;
+ bool exists;
+ }
+ function nredit(uint startindex) public constant returns(uint[500] CIDs, uint[500] dates, uint[500] RIDs, bool[500] Cboolas, uint[500] amounts){}
+ function return500InvoicesByDates(uint begindate, uint enddate, uint startindex) public constant returns(uint[500] AIDs, bool[500] Aboolas, uint[500] dates, bytes32[3][500] Abytesas, bytes32[3][500] bytesbs, bytes32[2][500] bytescs, uint[500] amounts, bool[500] Aboolbs, bool[500] Aboolcs){}
+ function return500PaymentsByDates(uint begindate, uint enddate, uint startindex) public constant returns(uint[500] BIDs, uint[500] dates, uint[500] RIDs, bool[500] Bboolas, bytes32[3][500] bytesbs,bytes32[2][500] bytescs, uint[500] amounts, bool[500] Bboolbs){}
+ }
+ )";
+ compileAndRun(sourceCode, 0, "C");
+}
+
BOOST_AUTO_TEST_CASE(literal_empty_string)
{
char const* sourceCode = R"(