You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// automatically generated from `func_test.fc`
DECLPROC calc
DECLPROC main
calc PROC:<{
DROP
TRUE
}>
main PROC:<{
256 PUSHNEGPOW2
calc CALLDICT
16 THROWIF
}>
Actual behavior when executed
calc always returns true.
Expected behavior when executed
Exit code 4, since - x should produce an overflow when x = -115792089237316195423570985008687907853269984665640564039457584007913129639936 (i.e., x = MIN_INT).
Side note 1: We can produce a related but different expression that also gets mapped into TRUE by replacing the subexpression - x for other expression that also produces overflows and the subexpression 0 for other expression that is equal to 0. For example, the following expressions also get transformed into TRUE in Fift, but they should produce error code 4 on the provided value for x:
(~(-1) * (-1 * x)) <= 0 for x = MIN_INT.
((1 & (~ 1)) * (x / -1)) <= 0 for x = MIN_INT.
((x & 0) * (x * 2)) <= 0 for x = MAX_INT (i.e., x = 115792089237316195423570985008687907853269984665640564039457584007913129639935).
((x * 0) * (x + 1)) <= 0 for x = MAX_INT.
Side note 2: The related expression (0 * (- x)) == 0 DOES get translated to Fift in the expected way:
calc PROC:<{
NEGATE
0 MULCONST
0 EQINT
}>
The text was updated successfully, but these errors were encountered:
Based on tact-lang/tact#3019
Code to reproduce
Output Fift
Actual behavior when executed
calc
always returnstrue
.Expected behavior when executed
Exit code 4, since
- x
should produce an overflow whenx = -115792089237316195423570985008687907853269984665640564039457584007913129639936
(i.e.,x = MIN_INT
).Side note 1: We can produce a related but different expression that also gets mapped into
TRUE
by replacing the subexpression- x
for other expression that also produces overflows and the subexpression0
for other expression that is equal to0
. For example, the following expressions also get transformed intoTRUE
in Fift, but they should produce error code 4 on the provided value forx
:(~(-1) * (-1 * x)) <= 0
forx = MIN_INT
.((1 & (~ 1)) * (x / -1)) <= 0
forx = MIN_INT
.((x & 0) * (x * 2)) <= 0
forx = MAX_INT
(i.e.,x = 115792089237316195423570985008687907853269984665640564039457584007913129639935
).((x * 0) * (x + 1)) <= 0
forx = MAX_INT
.Side note 2: The related expression
(0 * (- x)) == 0
DOES get translated to Fift in the expected way:The text was updated successfully, but these errors were encountered: