mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'origin/develop' into breaking
This commit is contained in:
@@ -1242,7 +1242,7 @@ BOOST_AUTO_TEST_CASE(use_stack_optimization)
|
||||
BOOST_CHECK(result["errors"][0]["severity"] == "error");
|
||||
BOOST_REQUIRE(result["errors"][0]["message"].isString());
|
||||
BOOST_CHECK(result["errors"][0]["message"].asString().find("Stack too deep when compiling inline assembly") != std::string::npos);
|
||||
BOOST_CHECK(result["errors"][0]["type"] == "YulException");
|
||||
BOOST_CHECK(result["errors"][0]["type"] == "CompilerError");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(standard_output_selection_wildcard)
|
||||
|
||||
@@ -6,5 +6,7 @@ contract C {
|
||||
return (s.a, s.b);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f((uint256,uint256)): 42, 23 -> 42, 23
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
uint256 a;
|
||||
bool x;
|
||||
}
|
||||
|
||||
function s() public returns(S memory)
|
||||
{
|
||||
return S({x: true, a: 8});
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// s() -> 8, true
|
||||
@@ -28,5 +28,7 @@ contract Test {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 1, 2, 3
|
||||
|
||||
@@ -38,5 +38,7 @@ contract Test {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 1, 2, 3, 4
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
contract C {
|
||||
struct I {
|
||||
uint b;
|
||||
uint c;
|
||||
function(uint) external returns (uint) x;
|
||||
}
|
||||
struct S {
|
||||
I a;
|
||||
}
|
||||
|
||||
function o(uint a) external returns(uint) { return a+1; }
|
||||
|
||||
function f() external returns (uint) {
|
||||
S memory s = S(I(1,2, this.o));
|
||||
return s.a.x(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 2
|
||||
@@ -0,0 +1,18 @@
|
||||
contract C {
|
||||
struct I {
|
||||
uint b;
|
||||
uint c;
|
||||
}
|
||||
struct S {
|
||||
I a;
|
||||
}
|
||||
|
||||
function f() external returns (uint) {
|
||||
S memory s = S(I(1,2));
|
||||
return s.a.b;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 1
|
||||
@@ -0,0 +1,14 @@
|
||||
contract C {
|
||||
struct S {
|
||||
uint a;
|
||||
}
|
||||
|
||||
function f() external returns (uint) {
|
||||
S memory s = S(1);
|
||||
return s.a;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 1
|
||||
@@ -27,6 +27,8 @@ contract test {
|
||||
data.recursive[4].z = 9;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// check() -> false
|
||||
// set() ->
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
abstract contract D {
|
||||
function d() external virtual;
|
||||
}
|
||||
|
||||
contract C {
|
||||
uint x;
|
||||
D d;
|
||||
function f() public {
|
||||
if (x < 10)
|
||||
++x;
|
||||
}
|
||||
function g() public {
|
||||
d.d();
|
||||
assert(x < 10);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4661: (200-214): Assertion violation happens here
|
||||
@@ -0,0 +1,29 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
abstract contract Crypto {
|
||||
function hash(bytes32) external pure virtual returns (bytes32);
|
||||
}
|
||||
|
||||
contract C {
|
||||
address owner;
|
||||
bytes32 sig_1;
|
||||
bytes32 sig_2;
|
||||
Crypto d;
|
||||
|
||||
constructor() public {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
function f1(bytes32 _msg) public {
|
||||
address prevOwner = owner;
|
||||
sig_1 = d.hash(_msg);
|
||||
sig_2 = d.hash(_msg);
|
||||
assert(prevOwner == owner);
|
||||
}
|
||||
|
||||
function inv() public view {
|
||||
assert(sig_1 == sig_2);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4661: (430-452): Assertion violation happens here
|
||||
@@ -0,0 +1,31 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract Crypto {
|
||||
function hash(bytes32) external pure returns (bytes32) {
|
||||
return bytes32(0);
|
||||
}
|
||||
}
|
||||
|
||||
contract C {
|
||||
address owner;
|
||||
bytes32 sig_1;
|
||||
bytes32 sig_2;
|
||||
Crypto d;
|
||||
|
||||
constructor() public {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
function f1(bytes32 _msg) public {
|
||||
address prevOwner = owner;
|
||||
sig_1 = d.hash(_msg);
|
||||
sig_2 = d.hash(_msg);
|
||||
assert(prevOwner == owner);
|
||||
}
|
||||
|
||||
function inv() public view {
|
||||
assert(sig_1 == sig_2);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4661: (438-460): Assertion violation happens here
|
||||
@@ -0,0 +1,38 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract State {
|
||||
uint x;
|
||||
function f() public returns (uint) {
|
||||
if (x == 0) x = 1;
|
||||
else if (x == 1) x = 2;
|
||||
else if (x == 2) x = 0;
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
contract C {
|
||||
address owner;
|
||||
uint y;
|
||||
uint z;
|
||||
State s;
|
||||
|
||||
constructor() public {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
function f() public {
|
||||
address prevOwner = owner;
|
||||
y = s.f();
|
||||
z = s.f();
|
||||
assert(prevOwner == owner);
|
||||
}
|
||||
|
||||
function inv() public view {
|
||||
// This is safe but external calls do not yet support the state
|
||||
// of the called contract.
|
||||
assert(owner == address(0) || y != z);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 5084: (551-561): Type conversion is not yet fully supported and might yield false positives.
|
||||
// Warning 4661: (535-572): Assertion violation happens here
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract State {
|
||||
uint x;
|
||||
C c;
|
||||
function f() public view returns (uint) {
|
||||
return c.g();
|
||||
}
|
||||
}
|
||||
|
||||
contract C {
|
||||
address owner;
|
||||
uint y;
|
||||
State s;
|
||||
|
||||
constructor() public {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
function f() public view {
|
||||
address prevOwner = owner;
|
||||
uint z = s.f();
|
||||
assert(z == y);
|
||||
assert(prevOwner == owner);
|
||||
}
|
||||
|
||||
function g() public view returns (uint) {
|
||||
return y;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4661: (306-320): Assertion violation happens here
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract Other {
|
||||
C c;
|
||||
function h() public {
|
||||
c.setOwner(address(0));
|
||||
}
|
||||
}
|
||||
|
||||
contract State {
|
||||
uint x;
|
||||
Other o;
|
||||
C c;
|
||||
function f() public returns (uint) {
|
||||
o.h();
|
||||
return c.g();
|
||||
}
|
||||
}
|
||||
|
||||
contract C {
|
||||
address owner;
|
||||
uint y;
|
||||
State s;
|
||||
|
||||
constructor() public {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
function setOwner(address _owner) public {
|
||||
owner = _owner;
|
||||
}
|
||||
|
||||
function f() public {
|
||||
address prevOwner = owner;
|
||||
uint z = s.f();
|
||||
assert(z == y);
|
||||
assert(prevOwner == owner);
|
||||
}
|
||||
|
||||
function g() public view returns (uint) {
|
||||
return y;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 5084: (92-102): Type conversion is not yet fully supported and might yield false positives.
|
||||
// Warning 4661: (459-473): Assertion violation happens here
|
||||
// Warning 4661: (477-503): Assertion violation happens here
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract State {
|
||||
uint x;
|
||||
C c;
|
||||
function f() public returns (uint) {
|
||||
c.setOwner(address(0));
|
||||
return c.g();
|
||||
}
|
||||
}
|
||||
|
||||
contract C {
|
||||
address owner;
|
||||
uint y;
|
||||
State s;
|
||||
|
||||
constructor() public {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
function setOwner(address _owner) public {
|
||||
owner = _owner;
|
||||
}
|
||||
|
||||
function f() public {
|
||||
address prevOwner = owner;
|
||||
uint z = s.f();
|
||||
assert(z == y);
|
||||
assert(prevOwner == owner);
|
||||
}
|
||||
|
||||
function g() public view returns (uint) {
|
||||
return y;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 5084: (116-126): Type conversion is not yet fully supported and might yield false positives.
|
||||
// Warning 4661: (388-402): Assertion violation happens here
|
||||
// Warning 4661: (406-432): Assertion violation happens here
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract State {
|
||||
uint x;
|
||||
function f() public returns (uint) {
|
||||
if (x == 0) x = 1;
|
||||
else if (x == 1) x = 2;
|
||||
else if (x == 2) x = 0;
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
contract C {
|
||||
address owner;
|
||||
uint y;
|
||||
uint z;
|
||||
State s;
|
||||
|
||||
constructor() public {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
function setOwner(address _owner) public {
|
||||
owner = _owner;
|
||||
}
|
||||
|
||||
function f() public {
|
||||
address prevOwner = owner;
|
||||
y = s.f();
|
||||
z = s.f();
|
||||
assert(prevOwner == owner);
|
||||
}
|
||||
|
||||
function inv() public view {
|
||||
// This is safe but external calls do not yet support the state
|
||||
// of the called contract.
|
||||
assert(owner == address(0) || y != z);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4661: (442-468): Assertion violation happens here
|
||||
// Warning 5084: (617-627): Type conversion is not yet fully supported and might yield false positives.
|
||||
// Warning 4661: (601-638): Assertion violation happens here
|
||||
@@ -0,0 +1,22 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
abstract contract D {
|
||||
function d() external virtual;
|
||||
}
|
||||
|
||||
contract C {
|
||||
uint x;
|
||||
D d;
|
||||
|
||||
function inc() public {
|
||||
++x;
|
||||
}
|
||||
|
||||
function f() public {
|
||||
d.d();
|
||||
assert(x < 10);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 2661: (146-149): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning 4661: (189-203): Assertion violation happens here
|
||||
@@ -0,0 +1,28 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
abstract contract D {
|
||||
function d() external virtual;
|
||||
}
|
||||
|
||||
contract C {
|
||||
uint x;
|
||||
uint y;
|
||||
D d;
|
||||
|
||||
function inc2() public {
|
||||
if (y == 1)
|
||||
x = 1;
|
||||
}
|
||||
function inc1() public {
|
||||
if (x == 0)
|
||||
y = 1;
|
||||
}
|
||||
|
||||
function f() public {
|
||||
uint oldX = x;
|
||||
d.d();
|
||||
assert(oldX == x);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4661: (286-303): Assertion violation happens here
|
||||
@@ -0,0 +1,18 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
abstract contract D {
|
||||
function d() external virtual;
|
||||
}
|
||||
|
||||
contract C {
|
||||
uint x;
|
||||
D d;
|
||||
function f() public {
|
||||
if (x < 10)
|
||||
++x;
|
||||
}
|
||||
function g() public {
|
||||
d.d();
|
||||
assert(x < 11);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
abstract contract D {
|
||||
function d() external virtual;
|
||||
}
|
||||
|
||||
contract C {
|
||||
uint x;
|
||||
uint y;
|
||||
D d;
|
||||
|
||||
function inc() public {
|
||||
if (y == 1)
|
||||
x = 1;
|
||||
if (x == 0)
|
||||
y = 1;
|
||||
}
|
||||
|
||||
function f() public {
|
||||
uint oldX = x;
|
||||
d.d();
|
||||
assert(oldX == x);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4661: (256-273): Assertion violation happens here
|
||||
@@ -0,0 +1,28 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
abstract contract D {
|
||||
function d() external virtual;
|
||||
}
|
||||
|
||||
contract C {
|
||||
uint x;
|
||||
D d;
|
||||
|
||||
bool lock;
|
||||
modifier mutex {
|
||||
require(!lock);
|
||||
lock = true;
|
||||
_;
|
||||
lock = false;
|
||||
}
|
||||
|
||||
function set(uint _x) mutex public {
|
||||
x = _x;
|
||||
}
|
||||
|
||||
function f() mutex public {
|
||||
uint y = x;
|
||||
d.d();
|
||||
assert(y == x);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
abstract contract D {
|
||||
function d() external virtual;
|
||||
}
|
||||
|
||||
contract C {
|
||||
uint x;
|
||||
D d;
|
||||
|
||||
bool lock;
|
||||
modifier mutex {
|
||||
require(!lock);
|
||||
lock = true;
|
||||
_;
|
||||
lock = false;
|
||||
}
|
||||
|
||||
function set(uint _x) mutex public {
|
||||
x = _x;
|
||||
}
|
||||
|
||||
function f() public {
|
||||
uint y = x;
|
||||
d.d();
|
||||
assert(y == x);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4661: (307-321): Assertion violation happens here
|
||||
@@ -17,4 +17,3 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4661: (257-271): Assertion violation happens here
|
||||
|
||||
@@ -18,4 +18,3 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 4661: (355-379): Assertion violation happens here
|
||||
|
||||
@@ -14,4 +14,6 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 1218: (296-309): Error trying to invoke SMT solver.
|
||||
// Warning 2661: (176-181): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning 4661: (296-309): Assertion violation happens here
|
||||
|
||||
@@ -20,6 +20,3 @@ contract C
|
||||
// ----
|
||||
// Warning 2072: (224-240): Unused local variable.
|
||||
// Warning 4661: (266-281): Assertion violation happens here
|
||||
// Warning 4661: (285-299): Assertion violation happens here
|
||||
// Warning 4661: (303-322): Assertion violation happens here
|
||||
// Warning 4661: (326-350): Assertion violation happens here
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
contract C {
|
||||
function f() pure external {
|
||||
assembly {
|
||||
let s := returndatasize()
|
||||
returndatacopy(0, 0, s)
|
||||
}
|
||||
}
|
||||
function g() view external returns (uint ret) {
|
||||
assembly {
|
||||
ret := staticcall(0, gas(), 0, 0, 0, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=byzantium
|
||||
// ----
|
||||
@@ -0,0 +1,21 @@
|
||||
contract C {
|
||||
function f() pure external {
|
||||
assembly {
|
||||
let s := returndatasize()
|
||||
returndatacopy(0, 0, s)
|
||||
}
|
||||
}
|
||||
function g() view external returns (uint ret) {
|
||||
assembly {
|
||||
ret := staticcall(0, gas(), 0, 0, 0, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: =homestead
|
||||
// ----
|
||||
// TypeError 7756: (86-100): The "returndatasize" instruction is only available for Byzantium-compatible VMs (you are currently compiling for "homestead").
|
||||
// DeclarationError 3812: (77-102): Variable count mismatch: 1 variables and 0 values.
|
||||
// TypeError 7756: (115-129): The "returndatacopy" instruction is only available for Byzantium-compatible VMs (you are currently compiling for "homestead").
|
||||
// TypeError 1503: (245-255): The "staticcall" instruction is only available for Byzantium-compatible VMs (you are currently compiling for "homestead").
|
||||
// DeclarationError 8678: (238-277): Variable count does not match number of values (1 vs. 0)
|
||||
@@ -0,0 +1,17 @@
|
||||
contract C {
|
||||
function f() view external returns (uint ret) {
|
||||
assembly {
|
||||
ret := shl(gas(), 5)
|
||||
ret := shr(ret, 2)
|
||||
ret := sar(ret, 2)
|
||||
}
|
||||
}
|
||||
function g() external returns (address ret) {
|
||||
assembly {
|
||||
ret := create2(0, 0, 0, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=constantinople
|
||||
// ----
|
||||
@@ -0,0 +1,25 @@
|
||||
contract C {
|
||||
function f() view external returns (uint ret) {
|
||||
assembly {
|
||||
ret := shl(gas(), 5)
|
||||
ret := shr(ret, 2)
|
||||
ret := sar(ret, 2)
|
||||
}
|
||||
}
|
||||
function g() external returns (address ret) {
|
||||
assembly {
|
||||
ret := create2(0, 0, 0, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: =byzantium
|
||||
// ----
|
||||
// TypeError 6612: (103-106): The "shl" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium").
|
||||
// DeclarationError 8678: (96-116): Variable count does not match number of values (1 vs. 0)
|
||||
// TypeError 6612: (136-139): The "shr" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium").
|
||||
// DeclarationError 8678: (129-147): Variable count does not match number of values (1 vs. 0)
|
||||
// TypeError 6612: (167-170): The "sar" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium").
|
||||
// DeclarationError 8678: (160-178): Variable count does not match number of values (1 vs. 0)
|
||||
// TypeError 6166: (283-290): The "create2" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium").
|
||||
// DeclarationError 8678: (276-302): Variable count does not match number of values (1 vs. 0)
|
||||
+2
-2
@@ -13,7 +13,7 @@ contract C {
|
||||
// ====
|
||||
// EVMVersion: =petersburg
|
||||
// ----
|
||||
// TypeError 7079: (101-108): The "chainid" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg").
|
||||
// TypeError 1561: (101-108): The "chainid" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg").
|
||||
// DeclarationError 8678: (95-110): Variable count does not match number of values (1 vs. 0)
|
||||
// TypeError 7079: (215-226): The "selfbalance" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg").
|
||||
// TypeError 3672: (215-226): The "selfbalance" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg").
|
||||
// DeclarationError 8678: (209-228): Variable count does not match number of values (1 vs. 0)
|
||||
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly {
|
||||
pop(linkersymbol("contract/library.sol:L"))
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 4619: (67-79): Function not found.
|
||||
// TypeError 3950: (67-105): Expected expression to evaluate to one value, but got 0 values instead.
|
||||
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly {
|
||||
function linkersymbol(a) {}
|
||||
|
||||
linkersymbol("contract/library.sol:L")
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
mapping(uint => uint[2**100]) x;
|
||||
}
|
||||
// ----
|
||||
// Warning 7325: (17-48): Type uint256[1267650600228229401496703205376] has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
|
||||
@@ -0,0 +1,4 @@
|
||||
contract C {
|
||||
uint[200][200][2**30][][2**30] x;
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,65 @@
|
||||
contract C {
|
||||
struct P { uint256[2**63] x; }
|
||||
|
||||
struct S0 {
|
||||
P[2**62] x;
|
||||
P y;
|
||||
}
|
||||
S0 s0;
|
||||
|
||||
struct S1 {
|
||||
P x;
|
||||
P[2**62] y;
|
||||
}
|
||||
S1 s1;
|
||||
|
||||
struct S2 {
|
||||
mapping(uint => P[2**62]) x;
|
||||
mapping(uint => P[2**62]) y;
|
||||
mapping(uint => S2) z;
|
||||
}
|
||||
S2 s2;
|
||||
|
||||
struct Q0
|
||||
{
|
||||
uint[1][][2**65] x;
|
||||
uint[2**65][][1] y;
|
||||
uint[][2**65] z;
|
||||
uint[2**65][] t;
|
||||
}
|
||||
Q0 q0;
|
||||
|
||||
struct Q1
|
||||
{
|
||||
uint[1][][2**65] x;
|
||||
}
|
||||
Q1 q1;
|
||||
|
||||
struct Q2
|
||||
{
|
||||
uint[2**65][][1] y;
|
||||
}
|
||||
Q2 q2;
|
||||
|
||||
struct Q3
|
||||
{
|
||||
uint[][2**65] z;
|
||||
}
|
||||
Q3 q3;
|
||||
|
||||
struct Q4
|
||||
{
|
||||
uint[2**65][] t;
|
||||
}
|
||||
Q4 q4;
|
||||
}
|
||||
// ----
|
||||
// Warning 3408: (108-113): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
|
||||
// Warning 3408: (175-180): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
|
||||
// Warning 7325: (314-319): Type C.P[4611686018427387904] has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
|
||||
// Warning 3408: (458-463): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
|
||||
// Warning 7325: (458-463): Type uint256[36893488147419103232] has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
|
||||
// Warning 3408: (524-529): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
|
||||
// Warning 7325: (590-595): Type uint256[36893488147419103232] has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
|
||||
// Warning 3408: (653-658): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
|
||||
// Warning 7325: (716-721): Type uint256[36893488147419103232] has large size and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
contract C {
|
||||
uint[200][200][2**30][][2**30] x;
|
||||
}
|
||||
// ----
|
||||
// Warning 3408: (17-49): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
|
||||
@@ -1,5 +0,0 @@
|
||||
contract C {
|
||||
mapping(uint => uint[2**100]) x;
|
||||
}
|
||||
// ----
|
||||
// Warning 3408: (17-48): Variable covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
|
||||
@@ -3,4 +3,4 @@ abstract contract C {
|
||||
function vote(uint id) public {}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 9222: End of tag @param not found
|
||||
// DocstringParsingError 3335: No param name given
|
||||
|
||||
@@ -255,6 +255,7 @@ TestCase::TestResult YulOptimizerTest::run(ostream& _stream, string const& _line
|
||||
else if (m_optimizerStep == "ssaTransform")
|
||||
{
|
||||
disambiguate();
|
||||
ForLoopInitRewriter::run(*m_context, *m_ast);
|
||||
SSATransform::run(*m_context, *m_ast);
|
||||
}
|
||||
else if (m_optimizerStep == "redundantAssignEliminator")
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
let x := calldataload(0)
|
||||
let a := mload(x)
|
||||
let b := mload(x)
|
||||
sstore(a, b)
|
||||
}
|
||||
// ----
|
||||
// step: loadResolver
|
||||
//
|
||||
// {
|
||||
// let a := mload(calldataload(0))
|
||||
// sstore(a, a)
|
||||
// }
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
let x := calldataload(0)
|
||||
let a := mload(x)
|
||||
x := 7
|
||||
let b := mload(x)
|
||||
sstore(a, b)
|
||||
}
|
||||
// ----
|
||||
// step: loadResolver
|
||||
//
|
||||
// {
|
||||
// let x := calldataload(0)
|
||||
// let a := mload(x)
|
||||
// x := 7
|
||||
// sstore(a, mload(x))
|
||||
// }
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
let x := calldataload(0)
|
||||
let a := mload(x)
|
||||
a := 7
|
||||
let b := mload(x)
|
||||
sstore(a, b)
|
||||
}
|
||||
// ----
|
||||
// step: loadResolver
|
||||
//
|
||||
// {
|
||||
// let x := calldataload(0)
|
||||
// let a := mload(x)
|
||||
// a := 7
|
||||
// sstore(a, mload(x))
|
||||
// }
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
let x := mload(calldataload(0))
|
||||
if calldataload(1) {
|
||||
mstore(add(calldataload(0), 0x20), 1)
|
||||
}
|
||||
let t := mload(add(calldataload(0), 0x20))
|
||||
let q := mload(calldataload(0))
|
||||
sstore(t, q)
|
||||
}
|
||||
// ----
|
||||
// step: loadResolver
|
||||
//
|
||||
// {
|
||||
// let _2 := calldataload(0)
|
||||
// let x := mload(_2)
|
||||
// let _3 := 1
|
||||
// if calldataload(_3) { mstore(add(_2, 0x20), _3) }
|
||||
// sstore(mload(add(_2, 0x20)), x)
|
||||
// }
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
let b := mload(2)
|
||||
if calldataload(1) {
|
||||
mstore(2, 7)
|
||||
// Re-writing the old value, should allow to eliminate the load below.
|
||||
mstore(2, b)
|
||||
}
|
||||
sstore(0, mload(2))
|
||||
}
|
||||
// ----
|
||||
// step: loadResolver
|
||||
//
|
||||
// {
|
||||
// let _1 := 2
|
||||
// let b := mload(_1)
|
||||
// if calldataload(1)
|
||||
// {
|
||||
// mstore(_1, 7)
|
||||
// mstore(_1, b)
|
||||
// }
|
||||
// sstore(0, b)
|
||||
// }
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
let b := mload(2)
|
||||
sstore(0, b)
|
||||
if calldataload(1) {
|
||||
mstore(2, 7)
|
||||
}
|
||||
sstore(0, mload(2))
|
||||
}
|
||||
// ----
|
||||
// step: loadResolver
|
||||
//
|
||||
// {
|
||||
// let _1 := 2
|
||||
// let b := mload(_1)
|
||||
// let _2 := 0
|
||||
// sstore(_2, b)
|
||||
// if calldataload(1) { mstore(_1, 7) }
|
||||
// sstore(_2, mload(_1))
|
||||
// }
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
let x := calldataload(0)
|
||||
x := mload(x)
|
||||
let y := mload(x)
|
||||
sstore(0, y)
|
||||
}
|
||||
// ----
|
||||
// step: loadResolver
|
||||
//
|
||||
// {
|
||||
// let _1 := 0
|
||||
// let x := calldataload(_1)
|
||||
// x := mload(x)
|
||||
// sstore(_1, mload(x))
|
||||
// }
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
let x := calldataload(0)
|
||||
let len := sload(x)
|
||||
let sum
|
||||
for { let i := 0} lt(i, sload(x)) { i := add(i, 1) } {
|
||||
let p := add(x, add(i, 1))
|
||||
if gt(p, sload(x)) { revert(0, 0) }
|
||||
sum := add(sum, sload(p))
|
||||
}
|
||||
mstore(0, sum)
|
||||
return(0, 0x20)
|
||||
}
|
||||
// ----
|
||||
// step: loadResolver
|
||||
//
|
||||
// {
|
||||
// let _1 := 0
|
||||
// let x := calldataload(_1)
|
||||
// let len := sload(x)
|
||||
// let sum
|
||||
// let i := _1
|
||||
// for { } lt(i, len) { i := add(i, 1) }
|
||||
// {
|
||||
// let p := add(add(x, i), 1)
|
||||
// if gt(p, len) { revert(_1, _1) }
|
||||
// sum := add(sum, sload(p))
|
||||
// }
|
||||
// mstore(_1, sum)
|
||||
// return(_1, 0x20)
|
||||
// }
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
for { let x := 0 } 1 { x := 2 } {
|
||||
for { let y := 0 } 1 { y := 6 } {
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// step: ssaTransform
|
||||
//
|
||||
// {
|
||||
// let x_1 := 0
|
||||
// let x := x_1
|
||||
// for { }
|
||||
// 1
|
||||
// {
|
||||
// let x_7 := x
|
||||
// let x_2 := 2
|
||||
// x := x_2
|
||||
// }
|
||||
// {
|
||||
// let x_5 := x
|
||||
// let y_3 := 0
|
||||
// let y := y_3
|
||||
// for { }
|
||||
// 1
|
||||
// {
|
||||
// let y_6 := y
|
||||
// let y_4 := 6
|
||||
// y := y_4
|
||||
// }
|
||||
// { }
|
||||
// }
|
||||
// }
|
||||
@@ -12,7 +12,8 @@
|
||||
// {
|
||||
// let a_1 := mload(0)
|
||||
// let a := a_1
|
||||
// for { mstore(0, a_1) }
|
||||
// mstore(0, a_1)
|
||||
// for { }
|
||||
// a
|
||||
// {
|
||||
// let a_4 := a
|
||||
|
||||
@@ -12,19 +12,9 @@
|
||||
// {
|
||||
// let a_1 := mload(0)
|
||||
// let a := a_1
|
||||
// for {
|
||||
// let a_2 := add(a_1, 3)
|
||||
// a := a_2
|
||||
// }
|
||||
// a
|
||||
// {
|
||||
// let a_4 := a
|
||||
// mstore(0, a_4)
|
||||
// }
|
||||
// {
|
||||
// let a_3 := a
|
||||
// mstore(0, a_3)
|
||||
// }
|
||||
// let a_5 := a
|
||||
// mstore(0, a_5)
|
||||
// let a_2 := add(a_1, 3)
|
||||
// a := a_2
|
||||
// for { } a_2 { mstore(0, a_2) }
|
||||
// { mstore(0, a_2) }
|
||||
// mstore(0, a_2)
|
||||
// }
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
// {
|
||||
// let a_1 := mload(0)
|
||||
// let a := a_1
|
||||
// for { mstore(0, a_1) }
|
||||
// mstore(0, a_1)
|
||||
// for { }
|
||||
// a
|
||||
// {
|
||||
// let a_4 := a
|
||||
|
||||
@@ -32,10 +32,9 @@
|
||||
// a := a_4
|
||||
// }
|
||||
// let a_10 := a
|
||||
// for {
|
||||
// let a_5 := add(a_10, 3)
|
||||
// a := a_5
|
||||
// }
|
||||
// let a_5 := add(a_10, 3)
|
||||
// a := a_5
|
||||
// for { }
|
||||
// a
|
||||
// {
|
||||
// let a_12 := a
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
function _...($..) {}
|
||||
let a...
|
||||
_...(a...)
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
function x..y() {}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
function x(a..b) {}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
function x() -> a..b {}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
let a..b := 1
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
function x...y() {}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
function x(a...b) {}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
function x() -> a...b {}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
let a...b := 1
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
function .x() {}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (15-16): Expected identifier but got '.'
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
function x(.a) {}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (17-18): Expected identifier but got '.'
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
function x() -> .a {}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (22-23): Expected identifier but got '.'
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
let .a := 1
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (10-11): Expected identifier but got '.'
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
function x.y() {}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
function x(a.b) {}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
function x() -> a.b {}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
let a.b := 1
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
function x.() {}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
function x(a.) {}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
function x() -> a. {}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
let a. := 1
|
||||
}
|
||||
// ----
|
||||
@@ -96,6 +96,9 @@ void FuzzerUtil::testCompiler(string const& _input, bool _optimize)
|
||||
catch (UnimplementedFeatureError const&)
|
||||
{
|
||||
}
|
||||
catch (StackTooDeepError const&)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void FuzzerUtil::runCompiler(string const& _input, bool _quiet)
|
||||
|
||||
@@ -59,13 +59,13 @@ DEFINE_PROTO_FUZZER(Program const& _input)
|
||||
);
|
||||
|
||||
// Parse protobuf mutated YUL code
|
||||
if (!stack.parseAndAnalyze("source", yul_source))
|
||||
return;
|
||||
|
||||
yulAssert(stack.errors().empty(), "Parsed successfully but had errors.");
|
||||
|
||||
if (!stack.parserResult()->code || !stack.parserResult()->analysisInfo)
|
||||
return;
|
||||
if (
|
||||
!stack.parseAndAnalyze("source", yul_source) ||
|
||||
!stack.parserResult()->code ||
|
||||
!stack.parserResult()->analysisInfo ||
|
||||
!Error::containsOnlyWarnings(stack.errors())
|
||||
)
|
||||
yulAssert(false, "Proto fuzzer generated malformed program");
|
||||
|
||||
// Optimize
|
||||
stack.optimize();
|
||||
|
||||
@@ -77,8 +77,12 @@ DEFINE_PROTO_FUZZER(Program const& _input)
|
||||
);
|
||||
|
||||
// Parse protobuf mutated YUL code
|
||||
if (!stack.parseAndAnalyze("source", yul_source) || !stack.parserResult()->code ||
|
||||
!stack.parserResult()->analysisInfo)
|
||||
if (
|
||||
!stack.parseAndAnalyze("source", yul_source) ||
|
||||
!stack.parserResult()->code ||
|
||||
!stack.parserResult()->analysisInfo ||
|
||||
!Error::containsOnlyWarnings(stack.errors())
|
||||
)
|
||||
{
|
||||
printErrors(std::cout, stack.errors());
|
||||
yulAssert(false, "Proto fuzzer generated malformed program");
|
||||
|
||||
Reference in New Issue
Block a user