This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/61004] [4.10 Regression] Spurious warning: dereferencing type-punned pointer
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 30 Apr 2014 09:41:24 +0000
- Subject: [Bug c++/61004] [4.10 Regression] Spurious warning: dereferencing type-punned pointer
- Auto-submitted: auto-generated
- References: <bug-61004-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61004
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
B doesn't have a FIELD_DECL for its base A, not sure why. If we make A
non-empty
we get
f ((const struct A &) (const struct A *) &b.D.2231)
with empty A (and no field for it) we get
f ((const struct A &) (const struct A *) &b)
I suppose this is to avoid having two fields at the same offset if we
make B not empty.
Now, that we don't record the alias-set of A as subset of that of B isn't
a problem in practice but for the (IMHO completely bogus) implementation
of our strict-aliasing warnings.