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 gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Jul 2009 03:50:37 -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 #5 from pinskia at gmail dot com 2009-07-07 03:50 -------
Subject: Re: dereferencing type-punned pointer warnings cannot be disabled
Thus code is undefined you have an acess of a char array as a struct.
Yes you are only taking the address of an element but it is still
considered an acess by the standards.
Sent from my iPhone
On Jul 6, 2009, at 6:34 PM, "mikulas at artax dot karlin dot mff dot
cuni dot cz" <gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #2 from mikulas at artax dot karlin dot mff dot cuni
> dot cz 2009-07-07 01:34 -------
> Created an attachment (id=18146)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18146&action=view)
> --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18146&action=view)
> a bug in -Wstrict-aliasing=3
>
> This is an example of a flaw in -Wstrict-aliasing=3 (this mode is
> very bad,
> produces many false positives on my project and I'm wondering why is
> it
> default?)
>
> Gcc man page says that -Wstrict-aliasing=3 produces less false
> positives than
> -Wstrict-aliasing=2. This is counterexample, it produces "type-
> punned" warning
> in -Wstrict-aliasing=3 mode and doesn't warn in -Wstrict-aliasing=2.
> I added
> (void *) casts everywhere, but they don't quash the warning.
>
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40665
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40665