This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled
- 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: 7 Jul 2009 20:24:29 -0000
- Subject: [Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled
- References: <bug-40665-1600@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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