https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86886
Qirun Zhang changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution|---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86886
--- Comment #4 from Jonathan Wakely ---
If you want to play these sort of games then you need to compile with
-fno-strict-aliasing (which you should have tried anyway if you'd read
https://gcc.gnu.org/bugs/ first)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86886
--- Comment #3 from Jonathan Wakely ---
Your second example has undefined behaviour, as you blatantly violate the
strict aliasing rules, and -Wstrict-aliasing=2 will warn you about it:
86886.c:5:1: warning: dereferencing type-punned pointer will
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86886
--- Comment #2 from Qirun Zhang ---
(In reply to Andrew Pinski from comment #1)
> I don't think this is a bug. You are taking the address of a field of an
> union and accessing via that address. This is not tracked at all.
Here is a reduced ca
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86886
--- Comment #1 from Andrew Pinski ---
I don't think this is a bug. You are taking the address of a field of an union
and accessing via that address. This is not tracked at all.