solidity/test/libsolidity/smtCheckerTests/unchecked/flipping_sign_tests.sol

13 lines
522 B
Solidity
Raw Normal View History

2020-12-16 17:32:34 +00:00
contract test {
function f() public pure returns (bool) {
int256 x = -2**255;
unchecked { assert(-x == x); }
assert(-x == x); // CHC apparently does not create an underflow target for unary minus
return true;
}
}
2021-03-31 15:11:54 +00:00
// ====
// SMTEngine: all
2020-12-16 17:32:34 +00:00
// ----
2021-03-31 15:11:54 +00:00
// Warning 6328: (110-125): CHC: Assertion violation happens here.\nCounterexample:\n\n = false\nx = (- 57896044618658097711785492504343953926634992332820282019728792003956564819968)\n\nTransaction trace:\ntest.constructor()\ntest.f()