[The bug has been reported to the Debian BTS before:
On s390, when using -O2, the attached code fails to throw an exception, apparently because it does not re-evaluate the value of a variable. If the variable is marked volatile, the code works as expected.
Created attachment 17255 [details]
Not fully preprocessed source (includes <string>), compile with -DVOLATILE to see the correct behaviour
Created attachment 17256 [details]
Fully preprocessed source, compile with -O2 to see wrong behaviour
I should have added that this worked fine on 4.2 and was broken as of 4.3.1 at least, earlier versions (> 4.2) untested.
Does it work with GCC 4.4?
Indeed, seems to be fixed in 4.4.0 (tested using Debian's gcc-snapshot, g++ (Debian 20090224-1) 4.4.0 20090224 (experimental)). Sorry for not testing using a fresh build from 4.4 sources, but I hope that is helpful nevertheless.
GCC 4.3.4 is being released, adjusting target milestone.
GCC 4.3.5 is being released, adjusting target milestone.
Fixed for 4.4.0.