diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-05-02 10:41:44 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-05-02 10:41:44 +0000 |
commit | 5056ba1a33d3f4891671b26c02048d5f7fbeca9f (patch) | |
tree | 61b2330a1ce5d4bae00e79479b913e9d6160443f /gcc/tree-cfg.c | |
parent | aade31a0ad15d489c644dbcf02c3681a4372bd4b (diff) | |
download | gcc-5056ba1a33d3f4891671b26c02048d5f7fbeca9f.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113455 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 744a9032b5f..4c5aa4bd4e7 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -4814,7 +4814,8 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, /* If ENTRY does not strictly dominate EXIT, this cannot be an SESE region. */ gcc_assert (entry_bb != exit_bb - && dominated_by_p (CDI_DOMINATORS, exit_bb, entry_bb)); + && (!exit_bb + || dominated_by_p (CDI_DOMINATORS, exit_bb, entry_bb))); bbs = NULL; VEC_safe_push (basic_block, heap, bbs, entry_bb); @@ -4835,15 +4836,25 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, remove_edge (e); } - num_exit_edges = EDGE_COUNT (exit_bb->succs); - exit_succ = (basic_block *) xcalloc (num_exit_edges, sizeof (basic_block)); - exit_flag = (int *) xcalloc (num_exit_edges, sizeof (int)); - i = 0; - for (ei = ei_start (exit_bb->succs); (e = ei_safe_edge (ei)) != NULL;) + if (exit_bb) { - exit_flag[i] = e->flags; - exit_succ[i++] = e->dest; - remove_edge (e); + num_exit_edges = EDGE_COUNT (exit_bb->succs); + exit_succ = (basic_block *) xcalloc (num_exit_edges, + sizeof (basic_block)); + exit_flag = (int *) xcalloc (num_exit_edges, sizeof (int)); + i = 0; + for (ei = ei_start (exit_bb->succs); (e = ei_safe_edge (ei)) != NULL;) + { + exit_flag[i] = e->flags; + exit_succ[i++] = e->dest; + remove_edge (e); + } + } + else + { + num_exit_edges = 0; + exit_succ = NULL; + exit_flag = NULL; } /* Switch context to the child function to initialize DEST_FN's CFG. */ @@ -4923,7 +4934,8 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, these helpers. */ cfun = dest_cfun; make_edge (ENTRY_BLOCK_PTR, entry_bb, EDGE_FALLTHRU); - make_edge (exit_bb, EXIT_BLOCK_PTR, 0); + if (exit_bb) + make_edge (exit_bb, EXIT_BLOCK_PTR, 0); cfun = saved_cfun; /* Back in the original function, the SESE region has disappeared, @@ -4935,10 +4947,13 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, for (i = 0; i < num_exit_edges; i++) make_edge (bb, exit_succ[i], exit_flag[i]); - free (exit_flag); + if (exit_bb) + { + free (exit_flag); + free (exit_succ); + } free (entry_flag); free (entry_pred); - free (exit_succ); free_dominance_info (CDI_DOMINATORS); free_dominance_info (CDI_POST_DOMINATORS); VEC_free (basic_block, heap, bbs); |