g++ -O2 segfaults on this code. Tested on gcc (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2). 4.7 and trunk work. 4.5 seems okay as well. struct A { A(); }; unsigned f1(); void f2() { while(true) { unsigned x; try { f1(); } catch(char) { x = (unsigned)-1; } if (x != 1) { new A; continue; } } }
Confirmed for 4.6.3, works on the 4.6 branch head. Probably a dup.