[SMTChecker] Fix ICE in string literal to fixed bytes implicit conversion

This commit is contained in:
Leonardo Alt
2019-11-13 22:25:18 +01:00
parent bc57566037
commit 8efacfb545
7 changed files with 69 additions and 7 deletions
@@ -0,0 +1,14 @@
pragma experimental SMTChecker;
contract B {
function f() pure public {
g("0123456");
}
function g(bytes7 a) pure public {
assert(a == "0123456");
assert(a == "1234567");
}
}
// ----
// Warning: (162-184): Assertion violation happens here
// Warning: (136-158): Assertion violation happens here
// Warning: (162-184): Assertion violation happens here
@@ -0,0 +1,11 @@
pragma experimental SMTChecker;
contract B {
function f() mod2("0123456") pure public { }
modifier mod2(bytes7 a) {
assert(a == "0123456");
assert(a == "1234567");
_;
}
}
// ----
// Warning: (152-174): Assertion violation happens here
@@ -0,0 +1,12 @@
pragma experimental SMTChecker;
contract C {
function g() public pure returns (bytes32 val) { return "abc"; }
function f1() public pure returns (bytes32 val) { return g(); }
function a() public pure {
assert(f1() == "abc");
assert(f1() == "cde");
}
}
// ----
// Warning: (238-259): Assertion violation happens here
@@ -0,0 +1,15 @@
pragma experimental SMTChecker;
contract C {
function h() public pure returns (bytes32 val, bytes3 val2) { return ("abc", "def"); }
function g() public pure returns (bytes32 val) { return "abc"; }
function f1() public pure returns (bytes32 val) { return g(); }
function f2() public pure returns (bytes32 val, bytes3 val2) { return h(); }
function a() public pure {
(bytes32 v1, bytes3 v2) = f2();
assert(v1 == "abc");
assert(v2 == "cde");
}
}
// ----
// Warning: (442-461): Assertion violation happens here