the attached C++ test program triggers this optimization bug. > /usr/bin/gcc -lstdc++ test.cpp > ./a.out val1=1234, val2=0 val1=1234, val2=1 --> OK > /usr/bin/gcc -lstdc++ -O1 test.cpp > ./a.out val1=3, val2=0 val1=3, val2=0 --> FAIL > /usr/bin/gcc -lstdc++ -O2 test.cpp > ./a.out val1=1234, val2=0 val1=1234, val2=1 --> OK Reproducible: Always
Created attachment 205622 [details] test program
This happens on intel 32bit and on AMD64 platforms with this compiler
Looks like a valid bug, but it would be better to report it upstream.
same results on Fedora 11 with Fedora's gcc 4.4.1
https://bugzilla.redhat.com/show_bug.cgi?id=526428 seems to work with the current gcc-4.4.1 in Fedora RawHide. Our Gentoo gcc-4.4.1 is too old.
Please don't whine (without a good reason). Anyway, seems fixed in gcc 4.4.2.
Fixed in 4.4.2.