2020-12-16 17:32:34 +00:00
|
|
|
pragma experimental SMTChecker;
|
|
|
|
|
|
|
|
contract C {
|
|
|
|
uint public x = msg.value - 10; // can underflow
|
|
|
|
constructor() payable {}
|
|
|
|
}
|
|
|
|
|
|
|
|
contract D {
|
|
|
|
function h() internal returns (uint) {
|
|
|
|
return msg.value - 10; // can underflow
|
|
|
|
}
|
|
|
|
function f() public {
|
|
|
|
unchecked {
|
|
|
|
h(); // unchecked here does not mean h does not underflow
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ----
|
2021-01-06 15:06:15 +00:00
|
|
|
// Warning 3944: (66-80): CHC: Underflow (resulting value less than 0) happens here.\nCounterexample:\nx = 0\n\nTransaction trace:\nC.constructor()
|
2021-01-11 21:17:32 +00:00
|
|
|
// Warning 3944: (193-207): CHC: Underflow (resulting value less than 0) happens here.\nCounterexample:\n\n\nTransaction trace:\nD.constructor()\nD.f()\n D.h() -- internal call
|