This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Problem with optimization setting -O3
Oliver Schneider <oliver@f-prot.com> writes:
> Here the macros. As I mentioned before, the behavior differs between
> little and big Endian platforms. x64 is a little Endian platform, though.
>
> /* Little Endian */
> #define LEND32(X) (uint32_t)(X)
> #define PUT32(X,Y) (*(uint32_t*)(X)) = LEND32(Y)
> #define GET32(X) (*(uint32_t*)(X))
That is indeed an aliasing violation. However, since you are using
-fno-strict-aliasing I guess that is not the problem in itself. From
your earlier description, gcc is somehow deciding that the alignment
is greater than it really is. I don't know what would cause that. My
guess would some combination of inlining with the type casting in the
macros.
Ian