This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/38486] Missing warning about type punning



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]