OSDN Git Service

PR c++/44127
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 14 May 2010 18:55:10 +0000 (18:55 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 14 May 2010 18:55:10 +0000 (18:55 +0000)
gcc:
* gimplify.c (gimplify_seq_add_stmt): No longer static.
* gimple.h: Declare it.
* gimple.c (gimple_build_eh_filter): No ops.
gcc/cp:
* cp-gimplify.c (gimplify_must_not_throw_expr): Use
gimple_build_eh_must_not_throw.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159407 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c
gcc/gimple.c
gcc/gimple.h
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/eh/terminate1.C [new file with mode: 0644]

index e803c13..a5309e1 100644 (file)
@@ -1,3 +1,10 @@
+2010-05-14  Jason Merrill  <jason@redhat.com>
+
+       PR c++/44127
+       * gimplify.c (gimplify_seq_add_stmt): No longer static.
+       * gimple.h: Declare it.
+       * gimple.c (gimple_build_eh_filter): No ops.
+
 2010-05-14  Jan Hubicka  <jh@suse.cz>
 
        * ipa.c (enqueue_cgraph_node): Update comment; do not re-enqueue
 2010-05-14  Jan Hubicka  <jh@suse.cz>
 
        * ipa.c (enqueue_cgraph_node): Update comment; do not re-enqueue
index a68f71c..eca1aaa 100644 (file)
@@ -1,3 +1,9 @@
+2010-05-14  Jason Merrill  <jason@redhat.com>
+
+       PR c++/44127
+       * cp-gimplify.c (gimplify_must_not_throw_expr): Use
+       gimple_build_eh_must_not_throw.
+
 2010-05-14  Martin Jambor  <mjambor@suse.cz>
 
        * cp-lang.c (LANG_HOOKS_FOLD_OBJ_TYPE_REF): Remove both its undef
 2010-05-14  Martin Jambor  <mjambor@suse.cz>
 
        * cp-lang.c (LANG_HOOKS_FOLD_OBJ_TYPE_REF): Remove both its undef
index d6ae28f..2e3f11d 100644 (file)
@@ -480,11 +480,16 @@ gimplify_must_not_throw_expr (tree *expr_p, gimple_seq *pre_p)
   tree stmt = *expr_p;
   tree temp = voidify_wrapper_expr (stmt, NULL);
   tree body = TREE_OPERAND (stmt, 0);
   tree stmt = *expr_p;
   tree temp = voidify_wrapper_expr (stmt, NULL);
   tree body = TREE_OPERAND (stmt, 0);
+  gimple_seq try_ = NULL;
+  gimple_seq catch_ = NULL;
+  gimple mnt;
 
 
-  stmt = build_gimple_eh_filter_tree (body, NULL_TREE,
-                                     build_call_n (terminate_node, 0));
+  gimplify_and_add (body, &try_);
+  mnt = gimple_build_eh_must_not_throw (terminate_node);
+  gimplify_seq_add_stmt (&catch_, mnt);
+  mnt = gimple_build_try (try_, catch_, GIMPLE_TRY_CATCH);
 
 
-  gimplify_and_add (stmt, pre_p);
+  gimplify_seq_add_stmt (pre_p, mnt);
   if (temp)
     {
       *expr_p = temp;
   if (temp)
     {
       *expr_p = temp;
index 6f61ca7..dd691a8 100644 (file)
@@ -636,7 +636,7 @@ gimple_build_eh_filter (tree types, gimple_seq failure)
 gimple
 gimple_build_eh_must_not_throw (tree decl)
 {
 gimple
 gimple_build_eh_must_not_throw (tree decl)
 {
-  gimple p = gimple_alloc (GIMPLE_EH_MUST_NOT_THROW, 1);
+  gimple p = gimple_alloc (GIMPLE_EH_MUST_NOT_THROW, 0);
 
   gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
   gcc_assert (flags_from_decl_or_type (decl) & ECF_NORETURN);
 
   gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
   gcc_assert (flags_from_decl_or_type (decl) & ECF_NORETURN);
index d1018b7..8ecf7eb 100644 (file)
@@ -221,6 +221,13 @@ gimple_seq_empty_p (const_gimple_seq s)
 
 void gimple_seq_add_stmt (gimple_seq *, gimple);
 
 
 void gimple_seq_add_stmt (gimple_seq *, gimple);
 
+/* Link gimple statement GS to the end of the sequence *SEQ_P.  If
+   *SEQ_P is NULL, a new sequence is allocated.  This function is
+   similar to gimple_seq_add_stmt, but does not scan the operands.
+   During gimplification, we need to manipulate statement sequences
+   before the def/use vectors have been constructed.  */
+void gimplify_seq_add_stmt (gimple_seq *, gimple);
+
 /* Allocate a new sequence and initialize its first element with STMT.  */
 
 static inline gimple_seq
 /* Allocate a new sequence and initialize its first element with STMT.  */
 
 static inline gimple_seq
index c741891..6d00fef 100644 (file)
@@ -158,7 +158,7 @@ gimple_tree_eq (const void *p1, const void *p2)
    During gimplification, we need to manipulate statement sequences
    before the def/use vectors have been constructed.  */
 
    During gimplification, we need to manipulate statement sequences
    before the def/use vectors have been constructed.  */
 
-static void
+void
 gimplify_seq_add_stmt (gimple_seq *seq_p, gimple gs)
 {
   gimple_stmt_iterator si;
 gimplify_seq_add_stmt (gimple_seq *seq_p, gimple gs)
 {
   gimple_stmt_iterator si;
index 92f9559..331b142 100644 (file)
@@ -1,3 +1,8 @@
+2010-05-14  Jason Merrill  <jason@redhat.com>
+
+       PR c++/44127
+       * g++.dg/eh/terminate1.C: New.
+
 2010-05-14  Jakub Jelinek  <jakub@redhat.com>
 
        * gfortran.dg/gomp/pr44036-1.f90: Adjust.
 2010-05-14  Jakub Jelinek  <jakub@redhat.com>
 
        * gfortran.dg/gomp/pr44036-1.f90: Adjust.
diff --git a/gcc/testsuite/g++.dg/eh/terminate1.C b/gcc/testsuite/g++.dg/eh/terminate1.C
new file mode 100644 (file)
index 0000000..cd60bcc
--- /dev/null
@@ -0,0 +1,23 @@
+// PR c++/44127
+
+// This is basically the same test as g++.eh/terminate1.C, but that one
+// tests runtime behavior and this tests the assembly output.  The test
+// should call terminate (because initializing the catch parm throws), but
+// from the personality routine, not directly.
+
+// { dg-final { scan-assembler-not "_ZSt9terminatev" } }
+
+struct A
+{
+  A() { }
+  A (const A&) { throw 1; }
+};
+
+int main()
+{
+  try
+    {
+      throw A();
+    }
+  catch (A) { }
+}