File gcc41-pr25874.patch of Package gcc

2006-04-18  Jakub Jelinek  <jakub@redhat.com>

	PR c++/25874
	* omp-low.c (expand_omp_parallel): If child_cfun->cfg, free dominators,
	post dominators and cleanup cfg before returning.

	* gcc.dg/gomp/pr25874.c: Add dg-options.
	* g++.dg/gomp/pr25874.C: Add dg-options.

--- gcc/omp-low.c.jj	2006-04-18 13:31:18.000000000 +0200
+++ gcc/omp-low.c	2006-04-18 13:57:03.000000000 +0200
@@ -2278,6 +2278,7 @@ expand_omp_parallel (struct omp_region *
   block_stmt_iterator si;
   tree entry_stmt;
   edge e;
+  bool do_cleanup_cfg = false;
 
   entry_stmt = last_stmt (region->entry);
   child_fn = OMP_PARALLEL_FN (entry_stmt);
@@ -2310,6 +2311,7 @@ expand_omp_parallel (struct omp_region *
       new_bb = entry_bb;
       remove_edge (entry_succ_e);
       make_edge (new_bb, exit_succ_e->dest, EDGE_FALLTHRU);
+      do_cleanup_cfg = true;
     }
   else
     {
@@ -2385,6 +2387,14 @@ expand_omp_parallel (struct omp_region *
 
   /* Emit a library call to launch the children threads.  */
   expand_parallel_call (region, new_bb, entry_stmt, ws_args);
+
+  if (do_cleanup_cfg)
+    {
+      /* Clean up the unreachable sub-graph we created above.  */
+      free_dominance_info (CDI_DOMINATORS);
+      free_dominance_info (CDI_POST_DOMINATORS);
+      cleanup_tree_cfg ();
+    }
 }
 
 
--- gcc/testsuite/gcc.dg/gomp/pr25874.c.jj	2006-01-30 09:01:58.000000000 +0100
+++ gcc/testsuite/gcc.dg/gomp/pr25874.c	2006-04-18 13:28:44.000000000 +0200
@@ -1,3 +1,5 @@
+/* { dg-options "-O -fopenmp" } */
+
 void foo();
 
 inline void bar()
--- gcc/testsuite/g++.dg/gomp/pr25874.C.jj	2006-03-12 09:51:23.000000000 +0100
+++ gcc/testsuite/g++.dg/gomp/pr25874.C	2006-04-18 13:29:11.000000000 +0200
@@ -1,3 +1,5 @@
+// { dg-options "-O -fopenmp" }
+
 int foo();
 
 struct wigner_d
openSUSE Build Service is sponsored by