Bug 57499 - [4.7 Regression] ICE when noreturn destructor returns after throw with -O
Summary: [4.7 Regression] ICE when noreturn destructor returns after throw with -O
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.7.2
: P2 normal
Target Milestone: 4.8.3
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2013-06-01 10:14 UTC by Frank Heckenbach
Modified: 2014-06-12 13:28 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.4.7, 4.8.3, 4.9.0
Known to fail: 4.5.4, 4.6.4, 4.7.2, 4.7.4, 4.8.1
Last reconfirmed: 2013-06-03 00:00:00


Attachments
Test case (124 bytes, text/x-c++src)
2013-06-01 10:14 UTC, Frank Heckenbach
Details
gcc47-pr57499.patch (647 bytes, patch)
2014-02-04 12:55 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Heckenbach 2013-06-01 10:14:14 UTC
Created attachment 30238 [details]
Test case

Got this while triaging #57498. The test program is clearly wrong, but since ICEs should always be reported ...

% g++-4.7 -O test.cpp 
test.cpp: In destructor 'foo::~foo()':
test.cpp:7:3: warning: 'noreturn' function does return [enabled by default]
test.cpp: In function 'int main()':
test.cpp:14:1: internal compiler error: Segmentation fault
Comment 1 Richard Biener 2013-06-03 08:46:56 UTC
Confirmed.

0xd197c5 crash_signal
        /space/rguenther/src/svn/trunk/gcc/toplev.c:333
0xd745a5 infinite_empty_loop_p
        /space/rguenther/src/svn/trunk/gcc/tree-eh.c:4187
0xd74908 cleanup_empty_eh
        /space/rguenther/src/svn/trunk/gcc/tree-eh.c:4263
0xd74d7e cleanup_all_empty_eh
        /space/rguenther/src/svn/trunk/gcc/tree-eh.c:4376
0xd74e0a execute_cleanup_eh_1
        /space/rguenther/src/svn/trunk/gcc/tree-eh.c:4405
0xd74e5b execute_cleanup_eh
        /space/rguenther/src/svn/trunk/gcc/tree-eh.c:4430
Comment 2 Jakub Jelinek 2014-02-04 10:20:05 UTC
Likely started with r151696.
Comment 3 Jakub Jelinek 2014-02-04 12:55:19 UTC
Created attachment 32037 [details]
gcc47-pr57499.patch

Untested fix.
Comment 4 Jakub Jelinek 2014-02-05 14:35:02 UTC
Author: jakub
Date: Wed Feb  5 14:34:30 2014
New Revision: 207504

URL: http://gcc.gnu.org/viewcvs?rev=207504&root=gcc&view=rev
Log:
	PR middle-end/57499
	* tree-eh.c (cleanup_empty_eh): Bail out on totally empty
	bb with no successors.

	* g++.dg/torture/pr57499.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/torture/pr57499.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-eh.c
Comment 5 Jakub Jelinek 2014-02-05 14:41:10 UTC
Fixed on the trunk so far.
Comment 6 Jakub Jelinek 2014-03-06 07:55:00 UTC
Author: jakub
Date: Thu Mar  6 07:54:28 2014
New Revision: 208363

URL: http://gcc.gnu.org/viewcvs?rev=208363&root=gcc&view=rev
Log:
	Backport from mainline
	2014-02-05  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/57499
	* tree-eh.c (cleanup_empty_eh): Bail out on totally empty
	bb with no successors.

	* g++.dg/torture/pr57499.C: New test.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/g++.dg/torture/pr57499.C
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_8-branch/gcc/tree-eh.c
Comment 7 Richard Biener 2014-06-12 13:28:15 UTC
Fixed in 4.8.3.