[Bug c/26492] -Wstrict-aliasing=2 warns about explicitly allowed cast to pointer to union.
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Sep 16 16:39:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26492
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target|i486-linux-gnu |
Status|UNCONFIRMED |NEW
Keywords| |diagnostic
Last reconfirmed| |2018-09-16
CC| |manu at gcc dot gnu.org
Host|i486-linux-gnu |
Ever confirmed|0 |1
Build|i486-linux-gnu |
--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
<source>:13:20: warning: dereferencing type-punned pointer might break
strict-aliasing rules [-Wstrict-aliasing]
4 | (((union { type __x__; __typeof__(*(ptr)) __y__;} *)(ptr))->__x__)
| ~~~~~
....
13 | noalias(usa, &a)[1] = 0;
<source>:4:58: note: in definition of macro 'noalias'
4 | (((union { type __x__; __typeof__(*(ptr)) __y__;} *)(ptr))->__x__)
| ^~~
More information about the Gcc-bugs
mailing list