From 2aee3e57aed77de4f5ef28a8711b315aeb1bf77c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 2 May 2006 12:41:44 +0200 Subject: re PR middle-end/27328 (ICE with -fopenmp and goto) PR middle-end/27328 * omp-low.c (remove_exit_barrier): Handle NULL exit_bb. (expand_omp_parallel): Likewise. * tree-cfg.c (move_sese_region_to_fn): Likewise. * gcc.dg/gomp/pr27328.c: New test. From-SVN: r113455 --- gcc/omp-low.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'gcc/omp-low.c') diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 92d71ae..62b715e 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -2227,6 +2227,11 @@ remove_exit_barrier (struct omp_region *region) exit_bb = region->exit; + /* If the parallel region doesn't return, we don't have REGION->EXIT + block at all. */ + if (! exit_bb) + return; + /* The last insn in the block will be the parallel's OMP_RETURN. The workshare's OMP_RETURN will be in a preceding block. The kinds of statements that can appear in between are extremely limited -- no @@ -2372,15 +2377,20 @@ expand_omp_parallel (struct omp_region *region) regions has invalidated it. */ free_dominance_info (CDI_DOMINATORS); new_bb = move_sese_region_to_fn (child_cfun, entry_bb, exit_bb); - single_succ_edge (new_bb)->flags = EDGE_FALLTHRU; + if (exit_bb) + single_succ_edge (new_bb)->flags = EDGE_FALLTHRU; cgraph_add_new_function (child_fn); /* Convert OMP_RETURN into a RETURN_EXPR. */ - si = bsi_last (exit_bb); - gcc_assert (!bsi_end_p (si) && TREE_CODE (bsi_stmt (si)) == OMP_RETURN); - t = build1 (RETURN_EXPR, void_type_node, NULL); - bsi_insert_after (&si, t, TSI_SAME_STMT); - bsi_remove (&si, true); + if (exit_bb) + { + si = bsi_last (exit_bb); + gcc_assert (!bsi_end_p (si) + && TREE_CODE (bsi_stmt (si)) == OMP_RETURN); + t = build1 (RETURN_EXPR, void_type_node, NULL); + bsi_insert_after (&si, t, TSI_SAME_STMT); + bsi_remove (&si, true); + } } /* Emit a library call to launch the children threads. */ -- cgit v1.1