http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49279
Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Status|NEW |ASSIGNED Known to work| |4.4.6 AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org |gnu.org | Summary|Optimization incorrectly |[4.5/4.6/4.7 Regression] |presuming constant variable |Optimization incorrectly |inside loop in g++ 4.5 and |presuming constant variable |4.6 with -O2 and -O3 for |inside loop in g++ 4.5 and |x86_64 targets |4.6 with -O2 and -O3 for | |x86_64 targets Known to fail| |4.5.4, 4.6.0, 4.7.0 --- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-06-06 09:05:21 UTC --- Passes with -fno-strict-aliasing. Presumably the alias-improvement branch merge is the real issue. Not sure if it isn't an issue with the testcase which has inline const Derived & derived () const { return *static_cast < const Derived *>(this); } inline Derived & derived () { return *static_cast < Derived * >(this); } I wasn't able to follow the template instantiation quickly ... ;) I will have a look.