https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100499

--- Comment #24 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
(In reply to Aldy Hernandez from comment #23)

> The above yields overflow for the 16-bit expression in question:
> 
> (gdb) p debug(top)
> g_2823_lsm.5_6 * 7854 + 57682
> 
> (gdb) p may_overflow_p (top)
> $6 = true
> 
> This is because the range of the above expression in unsigned 16-bit yields
> VARYING (R), whereas in 32-bit unsigned yields [57682, 514769572] (W).

Which, I will note, matches Andrew's hand calculation of:

>so the original expression is in 16 bit math, and if it was evaluated as
>     [0, 65535] * [7854, 7854] + [57682, 57682]
> in 32 bit precision, it would come back with the answer [57682, 514769572].

Reply via email to