Bug 28523 - [4.0 Regression] Throw of a derived class casted to its base class using a C-style cast
Summary: [4.0 Regression] Throw of a derived class casted to its base class using a C-...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.1
: P1 normal
Target Milestone: 4.1.2
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code, monitored
Depends on:
Blocks:
 
Reported: 2006-07-28 10:28 UTC by Márcio Faustino
Modified: 2007-02-03 18:39 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.3.3 4.1.2 4.2.0
Known to fail: 3.4.0 4.0.0 4.1.0 4.1.1
Last reconfirmed: 2006-07-28 11:12:45


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Márcio Faustino 2006-07-28 10:28:57 UTC
The compiler generates the error:
a.cpp: In function ‘int main()’:
a.cpp:6: internal compiler error: in stabilize_call, at cp/tree.c:2248


For this code:

class A {};
class B : public A {};

int main()
{
	throw (A) B();
	return 0;
}

Info:
gcc version 4.1.1
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.1.1-src/configure
Thread model: posix

Command line:
g++ -Wall -ansi -pedantic a.cpp
Comment 1 Andrew Pinski 2006-07-28 11:12:45 UTC
Confirmed.
Comment 2 Mark Mitchell 2006-08-01 20:05:25 UTC
Subject: Bug 28523

Author: mmitchel
Date: Tue Aug  1 20:04:57 2006
New Revision: 115862

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115862
Log:
	PR c++/28523
	* tree.c (stabilize_expr): Tweak documentation.  Add assertion.
	(stabilize_call): Tweak documentation.
	(stabilize_init): Only call stabilize_call for calls.
	PR c++/28523
	* g++.dg/eh/cast1.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/eh/cast1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/tree.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Mark Mitchell 2006-08-01 20:05:59 UTC
Subject: Bug 28523

Author: mmitchel
Date: Tue Aug  1 20:05:49 2006
New Revision: 115863

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115863
Log:
	PR c++/28523
	* tree.c (stabilize_expr): Tweak documentation.  Add assertion.
	(stabilize_call): Tweak documentation.
	(stabilize_init): Only call stabilize_call for calls.
	PR c++/28523
	* g++.dg/eh/cast1.C: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/eh/cast1.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/tree.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 4 Mark Mitchell 2006-08-01 21:33:25 UTC
Fixed in 4.1.2.
Comment 5 Gabriel Dos Reis 2007-02-03 18:39:07 UTC
Fixed in GCC-4.1.2