This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/61421] Invalid -O2 optimization breaks program
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 05 Jun 2014 22:00:39 +0000
- Subject: [Bug c++/61421] Invalid -O2 optimization breaks program
- Auto-submitted: auto-generated
- References: <bug-61421-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61421
--- Comment #17 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to mimamer from comment #16)
> Ah ok, but that doesn't solve my problem as I will eventually need to cast a
> node pointer back to T (either at the caller or the callee side). So there
> _is_ no efficient solution with strict aliasing rules. Which makes it kinda
> broken, IMO.
No that cast works iff the original type of the variable was T and in your case
the only time it was not T is when it is anchor so it should just work
correctly.