Bug 24288 - [3.4 Regression] Incorrect termination after exception is thrown, if compiled with -O1 -fomit-frame-pointer
Summary: [3.4 Regression] Incorrect termination after exception is thrown, if compiled...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 3.4.5
: P2 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2005-10-09 19:07 UTC by Marc Duerner
Modified: 2006-03-01 04:57 UTC (History)
1 user (show)

See Also:
Host:
Target: i686-pc-linux-gnu
Build:
Known to work: 4.1.0 4.0.0 3.3.3
Known to fail: 3.4.0
Last reconfirmed:


Attachments
test case (1.24 KB, application/x-tgz)
2005-10-09 19:08 UTC, Marc Duerner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Duerner 2005-10-09 19:07:09 UTC
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
Comment 1 Marc Duerner 2005-10-09 19:08:29 UTC
Created attachment 9947 [details]
test case
Comment 2 Andrew Pinski 2005-10-09 19:09:39 UTC
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.
Comment 3 Andrew Pinski 2005-10-10 04:48:42 UTC
Only a 3.4.x regression.
Comment 4 Gabriel Dos Reis 2006-03-01 04:57:11 UTC
Fixed in 4.0.0.