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

ktkachov at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |ktkachov at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #1 from ktkachov at gcc dot gnu.org ---
The code has undefined behaviour.
If you remove the -w, two of the warnings are:
bad.c:5:10: warning: initialization of ‘int *’ from incompatible pointer type
‘union <anonymous> *’ [-Wincompatible-pointer-types]
 int *c = &b;
          ^
bad.c:7:11: warning: initialization of ‘long int *’ from incompatible pointer
type ‘union <anonymous> *’ [-Wincompatible-pointer-types]
 long *d = &b;
           ^

These break strict-aliasing rule.
So if you use -fno-strict-aliasing you'll get FFFF as the output at all
optimisation levels

Reply via email to