Without -O3, code works as expected. With -O3, varible is reset to 0. Also, probably index overflow.
Where goes the .cc or .i ?? Bugzilla: Horribly scarce "user" interface! g++ -v outputs: Es werden eingebaute Spezifikationen verwendet. Ziel: i486-linux-gnu Konfiguriert mit: ../src/configure -v --with-pkgversion='Ubuntu 4.3.3-5ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread-Modell: posix gcc-Version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) -- Summary: -O3 gives wrong behaviour, no opt. OK Product: gcc Version: 4.3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: vielhaber at gmail dot com GCC host triplet: ??? intel x86 (AMD), Ubuntu 9.04, What do you want me to enter h http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40764