PR middle-end/34608
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 2 Jan 2008 23:33:54 +0000 (23:33 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 2 Jan 2008 23:33:54 +0000 (23:33 +0000)
* omp-low.c (expand_omp_parallel): Purge dead EH edges in the
child fn.

* g++.dg/gomp/pr34608.C: New test.

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

gcc/ChangeLog
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/gomp/pr34608.C [new file with mode: 0644]

index 803461c..f08d3af 100644 (file)
@@ -1,3 +1,9 @@
+2008-01-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/34608
+       * omp-low.c (expand_omp_parallel): Purge dead EH edges in the
+       child fn.
+
 2008-01-02  Richard Sandiford  <rsandifo@nildram.co.uk>
 
        * tree-sra.c (scalarize_init): Insert the generate_element_init
index 36fb13d..cf4ae12 100644 (file)
@@ -3,7 +3,7 @@
    marshalling to implement data sharing and copying clauses.
    Contributed by Diego Novillo <dnovillo@redhat.com>
 
-   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -2646,6 +2646,24 @@ expand_omp_parallel (struct omp_region *region)
       if (optimize)
        optimize_omp_library_calls ();
       rebuild_cgraph_edges ();
+
+      /* Some EH regions might become dead, see PR34608.  If
+        pass_cleanup_cfg isn't the first pass to happen with the
+        new child, these dead EH edges might cause problems.
+        Clean them up now.  */
+      if (flag_exceptions)
+       {
+         basic_block bb;
+         tree save_current = current_function_decl;
+         bool changed = false;
+
+         current_function_decl = child_fn;
+         FOR_EACH_BB (bb)
+           changed |= tree_purge_dead_eh_edges (bb);
+         if (changed)
+           cleanup_tree_cfg ();
+         current_function_decl = save_current;
+       }
       pop_cfun ();
     }
   
index b16a2b1..c23446b 100644 (file)
@@ -1,3 +1,8 @@
+2008-01-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/34608
+       * g++.dg/gomp/pr34608.C: New test.
+
 2008-01-02  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/34093
diff --git a/gcc/testsuite/g++.dg/gomp/pr34608.C b/gcc/testsuite/g++.dg/gomp/pr34608.C
new file mode 100644 (file)
index 0000000..759ab3f
--- /dev/null
@@ -0,0 +1,19 @@
+// PR middle-end/34608
+// { dg-do compile }
+// { dg-options "-ftest-coverage -fopenmp" }
+
+struct A
+{
+  ~A () throw ();
+};
+
+void foo (A);
+
+void
+bar ()
+{
+#pragma omp parallel
+  foo (A ());
+}
+
+// { dg-final { cleanup-coverage-files } }