https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80130

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #2)
> I only get 1 warning on (1) and only with -Wstrict-aliasing=1.
> -Wstrict-aliasing=2 and -Wstrict-aliasing=3 are both silent.
> 
> (In reply to Richard Biener from comment #1)
> > The warning implementation is incredibly stupid, don't use it.  It doesn't
> > have any context (so the two stmt variant is different from the single stmt
> > one).
> 
> It'd still be nice if it could be improved though. Although, maybe it
> already has been?

I don't see how it can be improved.  Iff the compiler can detect an
aliasing violation it may as well try to be conservative (which in
fact we do later during optimization).

Jakub has attempted to do a TBAA sanitizer, not sure how far that went though,
it is quite meta-data heavy to do "correctly".  Still tracking the dynamic
type of storage at runtime and then instrumenting each access is the only
way to reliably detect TBAA violations (without false positives).

Reply via email to