[Bug rtl-optimization/83124] wrong code on arm-linux-gnueabi-gcc with -O3 optimization

ktkachov at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Nov 23 09:53:00 GMT 2017


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


More information about the Gcc-bugs mailing list