mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[SMTChecker] Fix SMT logic error when doing compound assignment with string literlas.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
bytes memory y = "def";
|
||||
y[0] &= "d";
|
||||
assert(y[0] == "d");
|
||||
|
||||
y[0] |= "e";
|
||||
assert(y[0] == "d"); // fails
|
||||
|
||||
y[0] ^= "f";
|
||||
assert(y[0] == (byte("d") | byte("e")) ^ byte("f"));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (189-208): CHC: Assertion violation happens here.
|
||||
@@ -0,0 +1,17 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
bytes3 y = "def";
|
||||
y &= "def";
|
||||
assert(y == "def");
|
||||
|
||||
y |= "dee";
|
||||
assert(y == "def"); // fails
|
||||
|
||||
y ^= "fed";
|
||||
assert(y == (bytes3("def") | bytes3("dee")) ^ bytes3("fed"));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (180-198): CHC: Assertion violation happens here.
|
||||
@@ -0,0 +1,21 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
bytes32 y = "abcdefghabcdefghabcdefghabcdefgh";
|
||||
bytes32 z = y;
|
||||
y &= "bcdefghabcdefghabcdefghabcdefgha";
|
||||
z &= "bcdefghabcdefghabcdefghabcdefgha";
|
||||
assert(y == "abcdefghabcdefghabcdefghabcdefgh"); // fails
|
||||
|
||||
y |= "cdefghabcdefghabcdefghabcdefghab";
|
||||
z |= "cdefghabcdefghabcdefghabcdefghab";
|
||||
assert(y == "abcdefghabcdefghabcdefghabcd"); // fails
|
||||
|
||||
y ^= "abcdefghabcdefghabcdefghabcdefgh";
|
||||
assert(y == z ^ "abcdefghabcdefghabcdefghabcdefgh");
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (262-309): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (427-470): CHC: Assertion violation happens here.
|
||||
Reference in New Issue
Block a user