This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/38486] Missing warning about type punning
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Dec 2008 18:53:43 -0000
- Subject: [Bug middle-end/38486] Missing warning about type punning
- References: <bug-38486-4938@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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