[Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Jul 7 20:24:00 GMT 2009



------- Comment #13 from pinskia at gcc dot gnu dot org  2009-07-07 20:24 -------
(In reply to comment #12)
> So if there was char *buffer = malloc(512) instead of char buffer[512], would
> it be correct to cast it to the pointer to structure?

Yes.

> > And it is not about the cast between the pointer types which causes it to be
> > undefined but rather the accesses.
> 
> What is considered the "access" in that code? Is it the "->" operator? "&"
> operator? "=" operator? Cast operator? Or anything else?

The following three operators are causes an access to happen even if & is used
afterwards:
"->", ".", and "*"

Thanks,
Andrew PInski


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40665



More information about the Gcc-bugs mailing list