The following test program goes into an infinite loop when compiled with -O2 and -fno-strict-aliasing but works correctly if -fno-strict-aliasing is omitted.
$ g++-3.4 -g -O2 -fno-strict-aliasing -o loop loop.C // loop.C class DummyType { public: ~DummyType() { } }; class Foo { public: Foo() : X0(0), X4(0) { } int X0, X1, X2, X3, X4; }; int main(int, char**) { { Foo f; DummyType d; } Foo f2; bool done(false); while (!done) { if (f2.X4 != 0) f2.X4 = 0; else done = true;; } return 0; } ----- Reading specs from /usr/lib/gcc/i486-linux/3.4.4/specs Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk --disable-werror i486-linux Thread model: posix gcc version 3.4.4 20050314 (prerelease) (Debian 3.4.3-13) -- Summary: Optimizer creates infinite loop with -fno-strict- aliasing Product: gcc Version: 3.4.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: cnewbold at mathworks dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24812