[Bug middle-end/38486] Missing warning about type punning
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sat Dec 20 18:55:00 GMT 2008
------- Comment #5 from pinskia at gcc dot gnu dot org 2008-12-20 18:53 -------
(In reply to comment #4)
> Yes. Though you have to be careful not to create false positives for
>
> float f;
> struct X { int i; };
>
> struct X *p = (struct X *)&f;
> float *q = (float *)&p->i;
> return *q;
Actually that is an aliasing violation still as you still accessing *p, yes it
looks like it is not an access because of the address but you are still
accessing *p really.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38486
More information about the Gcc-bugs
mailing list