On 04/18/19 10:45, Laszlo Ersek wrote: > Beyond that, I checked the documentation of "-fstrict-aliasing" in the > gcc manual at > <https://gcc.gnu.org/onlinedocs/gcc-8.3.0/gcc/Optimize-Options.html>. It > provides several examples; one of them is: > >> Similarly, access by taking the address, casting the resulting pointer >> and dereferencing the result has undefined behavior, even if the cast >> uses a union type, e.g.: >> >> union a_union { >> int i; >> double d; >> }; >> >> int f() { >> double d = 3.0; >> return ((union a_union *) &d)->i; >> } > > I think the access in this example is well defined (I seem able to > deduce it using the effective type rules), and so I consider this a bug > in the gcc docs. I reached out to someone in the toolchain team at Red > Hat to confirm or disprove.
I was told to file an upstream GCC BZ about this, in order to reach a wider circle of experts. In case someone from edk2-devel would like to monitor that BZ: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90167 Thanks, Laszlo -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#39320): https://edk2.groups.io/g/devel/message/39320 Mute This Topic: https://groups.io/mt/31070304/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-