mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9881 from ethereum/smt_fixed_bytes_index_access
[SMTChecker] Support fixed bytes index access
This commit is contained in:
@@ -6,5 +6,3 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 7989: (116-120): Assertion checker does not yet support index accessing fixed bytes.
|
||||
// Warning 7989: (108-122): Assertion checker does not yet support index accessing fixed bytes.
|
||||
|
||||
@@ -6,4 +6,3 @@ contract c {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 7989: (123-134): Assertion checker does not yet support index accessing fixed bytes.
|
||||
|
||||
@@ -6,6 +6,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 7989: (101-108): Assertion checker does not yet support index accessing fixed bytes.
|
||||
// Warning 7989: (112-121): Assertion checker does not yet support index accessing fixed bytes.
|
||||
// Warning 3046: (117-120): Division by zero happens here.
|
||||
|
||||
@@ -13,5 +13,3 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 7989: (238-247): Assertion checker does not yet support index accessing fixed bytes.
|
||||
// Warning 7989: (251-257): Assertion checker does not yet support index accessing fixed bytes.
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
bytes32 x = 0x00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff;
|
||||
byte z = 0x00;
|
||||
byte o = 0xff;
|
||||
assert(x[0] == z);
|
||||
assert(x[31] == o);
|
||||
assert(x[0] == x[22]);
|
||||
assert(x[0] == x[23]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (260-281): Assertion violation happens here.
|
||||
@@ -0,0 +1,16 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
bytes4 x = 0x01020304;
|
||||
byte b = 0x02;
|
||||
assert(x[0] == b); // fails
|
||||
assert(x[1] == b);
|
||||
assert(x[2] == b); // fails
|
||||
assert(x[3] == b); // fails
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (118-135): Assertion violation happens here.
|
||||
// Warning 6328: (169-186): Assertion violation happens here.
|
||||
// Warning 6328: (199-216): Assertion violation happens here.
|
||||
@@ -0,0 +1,11 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
bytes4 x = 0x01020304;
|
||||
byte b = x[3];
|
||||
assert(b == b[0]);
|
||||
assert(b == b[0][0]);
|
||||
assert(b == b[0][0][0][0][0][0][0][0][0][0][0]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function f(uint i) public pure {
|
||||
bytes4 x = 0x01020304;
|
||||
require(i > 3);
|
||||
assert(x[i] == 0x00);
|
||||
i = 5;
|
||||
assert(x[i] == 0);
|
||||
assert(x[i] != 0);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (125-145): Assertion violation happens here.
|
||||
// Warning 6328: (158-175): Assertion violation happens here.
|
||||
// Warning 6328: (179-196): Assertion violation happens here.
|
||||
Reference in New Issue
Block a user