[Bug c++/61004] [4.10 Regression] Spurious warning: dereferencing type-punned pointer

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 30 09:41:00 GMT 2014


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.



More information about the Gcc-bugs mailing list