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: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 09 Mar 2016 10:53:47 +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 #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Pedro Alves from comment #8)
> I see it the same as:
>
> int *ip = &ap->k;
> ((struct b *)ip)->j;
That is certainly not fine from aliasing perspective, aliasing is not just
about the type of the field you access, but the whole access path, so if you
use ((struct b *)ip)->j then ip should point to an object with effective type
of struct b.
But, I'm afraid we can't warn about this for -Wstrict-aliasing=3, because that
would lead to too many false positives.