[Bug c/67090] [5/6 Regression] O2/O3 optimizes values away when different type pointers are typecasted

davispuh at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Aug 1 18:27:00 GMT 2015


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

--- Comment #3 from Dāvis <davispuh at gmail dot com> ---
(In reply to Andrew Pinski from comment #2)
> This is such an obvious violation of aliasing rules in c/c++. 
> Use memcpy or an Union (gcc extension) to get around the it. You can use
> -fno-strict-aliasing too.

Then warning (or error) would be more appropriate than silently generating
invalid code as currently there's no warning even with -Wall


More information about the Gcc-bugs mailing list