[Bug c/69760] Wrong 64-bit memory address caused by an unneeded overflowing 32-bit integer multiplication on x86_64 under -O2 and -O3 code optimization

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 11 00:20:00 GMT 2016


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The type of L*k is still int.

So overflow is undefined.

-fsantize=undefined will detect this.  Also -fwrapv will produce the result you
want as it will treat overflow as wrapping rather than undefined.


More information about the Gcc-bugs mailing list