summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-12 05:17:42 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-12 05:17:42 +0000
commit3b50f8cbc13e04294332211ea899d8cf19a3e1be (patch)
tree22161d69312ee914b3ef780ef0a534744352e972
parent2e3f487777bc08719871aed1a0807e9a969ab48d (diff)
downloadppe42-gcc-3b50f8cbc13e04294332211ea899d8cf19a3e1be.tar.gz
ppe42-gcc-3b50f8cbc13e04294332211ea899d8cf19a3e1be.zip
PR c++/16698
* except.c (build_throw): Allocate cleanup_type and the function for __cxa_throw separately. PR c++/16698 * g++.dg/eh/crash1.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85850 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/except.c20
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/eh/crash1.C5
4 files changed, 22 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3fba6273d48..2bc5a854100 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2004-08-11 Mark Mitchell <mark@codesourcery.com>
+ PR c++/16698
+ * except.c (build_throw): Allocate cleanup_type and the function
+ for __cxa_throw separately.
+
PR c++/16853
* call.c (standard_conversion): Do not accept conversions between
pointers to members if the class types are unrelated.
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 91f9c87849d..b78cecd5d86 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -611,18 +611,18 @@ build_throw (tree exp)
tree temp_expr, allocate_expr;
bool elided;
+ /* The CLEANUP_TYPE is the internal type of a destructor. */
+ if (!cleanup_type)
+ {
+ tmp = void_list_node;
+ tmp = tree_cons (NULL_TREE, ptr_type_node, tmp);
+ tmp = build_function_type (void_type_node, tmp);
+ cleanup_type = build_pointer_type (tmp);
+ }
+
fn = get_identifier ("__cxa_throw");
if (!get_global_value_if_present (fn, &fn))
{
- /* The CLEANUP_TYPE is the internal type of a destructor. */
- if (cleanup_type == NULL_TREE)
- {
- tmp = void_list_node;
- tmp = tree_cons (NULL_TREE, ptr_type_node, tmp);
- tmp = build_function_type (void_type_node, tmp);
- cleanup_type = build_pointer_type (tmp);
- }
-
/* Declare void __cxa_throw (void*, void*, void (*)(void*)). */
/* ??? Second argument is supposed to be "std::type_info*". */
tmp = void_list_node;
@@ -632,7 +632,7 @@ build_throw (tree exp)
tmp = build_function_type (void_type_node, tmp);
fn = push_throw_library_fn (fn, tmp);
}
-
+
/* throw expression */
/* First, decay it. */
exp = decay_conversion (exp);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index dd98c39fc03..93a6e56c99a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2004-08-11 Mark Mitchell <mark@codesourcery.com>
+ PR c++/16698
+ * g++.dg/eh/crash1.C: New test.
+
PR c++/16717
* g++.dg/ext/construct1.C: New test.
diff --git a/gcc/testsuite/g++.dg/eh/crash1.C b/gcc/testsuite/g++.dg/eh/crash1.C
new file mode 100644
index 00000000000..4cbcbd3ec1c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/eh/crash1.C
@@ -0,0 +1,5 @@
+extern "C" void __cxa_throw (void *, void *, void (*) (void *) );
+
+void foo(){
+ throw 1;
+}
OpenPOWER on IntegriCloud