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

15 lines
439 B
Solidity
Raw Normal View History

2020-12-16 17:32:34 +00:00
contract C {
function add(uint16 a, uint16 b) public pure returns (uint16) {
return a + b; // can overflow
}
function f(uint16 a, uint16 b, uint16 c) public pure returns (uint16) {
unchecked { return add(a, b) + c; } // add can still overflow, `+ c` can't
}
}
2021-03-31 15:11:54 +00:00
// ====
// SMTEngine: all
2022-05-04 14:29:50 +00:00
// SMTIgnoreCex: yes
2020-12-16 17:32:34 +00:00
// ----
2022-05-04 14:29:50 +00:00
// Warning 4984: (96-101): CHC: Overflow (resulting value larger than 65535) happens here.