[Bug c++/103699] Reading or writing a constant unaligned value is wrongly optimized causing an incorrect result (GCC-11 and up)
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Dec 14 02:05:21 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103699
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Petr from comment #8)
> So yeah, we can talk about breaking strict aliasing here, but it's just
> inconsistent. I would just expect all functions return the same value.
inconsistent because the behavior is undefined ....
In the case of the local array, GCC decides the store to array + 6 is not
needed and is removed.
It is inconsistent due to the inlining choices really. This is why in my
simplified example in comment #7, -fno-early-inlining is needed and all.
GCC 11+ is even more picky about strict aliasing than before really. That is
the basic thing here.
More information about the Gcc-bugs
mailing list