[Bug c++/106542] -O2 sign-extended uint32 to uint64

wuz73 at hotmail dot com gcc-bugzilla@gcc.gnu.org
Sat Aug 6 03:51:13 GMT 2022


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

wuz73 at hotmail dot com changed:

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

--- Comment #2 from wuz73 at hotmail dot com ---
(In reply to Andrew Pinski from comment #1)
> The code is undefined and can be detected with -fsanitize=undefined:
> 
> /app/example.cpp:15:14: runtime error: signed integer overflow: 2086724600 -
> -1610499096 cannot be represented in type 'int'

I'm only interested in the lower 32 bits, hence the unsigned(d).


More information about the Gcc-bugs mailing list