When an exception is thrown the program terminates instead of catching the exception. This only happens with -O1 or higher and -fomit-frame-pointer. The problem does not occur when: - the throwing function is not virtual - the throwing function is not an operator - the throwing function does not call the non-inline base class function Disabling parts of -O1 still triggers the problem ( -fno-defer-pop -fno-merge-constants -fno-thread-jumps -fno-loop-optimize -fno-if-conversion -fno-if-conversion2 -fno-guess-branch-probability -fno-cprop-registers ) Output of attached test-case with -O: # throwing... CATCHED UNKNOWN EXCEPTION. Output of attached test-case with -O1 -fomit-frame-pointer: # throwing... terminate called after throwing an instance of 'std::range_error' what(): Test exception. Aborted
Created attachment 9947 [details] test case
I think this has been fixed for 4.0.0, won't know until there is a testcase. Oh, this is more of an interaction between fomit-frame-pointer and eh tables.
Only a 3.4.x regression.
Fixed in 4.0.0.