This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/70143] [6 Regression] false strict-aliasing warning
- From: "palves at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 09 Mar 2016 10:16:28 +0000
- Subject: [Bug c/70143] [6 Regression] false strict-aliasing warning
- Auto-submitted: auto-generated
- References: <bug-70143-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70143
--- Comment #4 from Pedro Alves <palves at redhat dot com> ---
> The warning is "correct". You are accessing object *ap (a struct a) via a
> pointer to struct b.
I'd think that instead, we are accessing object "*&ap->i", an int, via a
pointer
to struct b, and I'd imagine that the problem is that the frontend doesn't know
that struct *b and int * can alias, because the first field of 'struct a',
which
in turn is the first field of 'struct b', is an int.
So I don't see how you can call this correct?
Is this really just a warning problem, or does the compiler really think that
struct *b and int * cannot alias?
> I'll see if we can somehow make the FE code "smarter".
I imagine that the frontend misses recursing through the first field of the
first field of a struct, when adding valid-alias types.