aboutsummaryrefslogtreecommitdiff
path: root/gcc/except.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-04-15 00:24:59 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2006-04-15 00:24:59 +0200
commit7e2df4a192476c23624aa62799844224b6b53938 (patch)
tree1cf0a8f2ef66b04878785ffcb60ed3de58e0a0b7 /gcc/except.c
parent008712ae1cf581c664f18f44ccac6d36ccbf3b93 (diff)
downloadgcc-7e2df4a192476c23624aa62799844224b6b53938.zip
gcc-7e2df4a192476c23624aa62799844224b6b53938.tar.gz
gcc-7e2df4a192476c23624aa62799844224b6b53938.tar.bz2
re PR middle-end/26823 (ICE with OpenMP in add_stmt_to_eh_region_fn, at tree-eh.c:100)
PR middle-end/26823 * except.h (eh_region_outermost): New prototype. * except.c (eh_region_outermost): New function. * tree-cfg.c (find_outermost_region_in_block): Use it. * g++.dg/gomp/pr26823-1.C: New test. * g++.dg/gomp/pr26823-2.C: New test. From-SVN: r112959
Diffstat (limited to 'gcc/except.c')
-rw-r--r--gcc/except.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/except.c b/gcc/except.c
index 3feda0f..57e71bd 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -1078,6 +1078,48 @@ eh_region_outer_p (struct function *ifun, int region_a, int region_b)
return false;
}
+
+/* Return region number of region that is outer to both if REGION_A and
+ REGION_B in IFUN. */
+
+int
+eh_region_outermost (struct function *ifun, int region_a, int region_b)
+{
+ struct eh_region *rp_a, *rp_b;
+ sbitmap b_outer;
+
+ gcc_assert (ifun->eh->last_region_number > 0);
+ gcc_assert (ifun->eh->region_tree);
+
+ rp_a = VEC_index (eh_region, ifun->eh->region_array, region_a);
+ rp_b = VEC_index (eh_region, ifun->eh->region_array, region_b);
+ gcc_assert (rp_a != NULL);
+ gcc_assert (rp_b != NULL);
+
+ b_outer = sbitmap_alloc (ifun->eh->last_region_number + 1);
+ sbitmap_zero (b_outer);
+
+ do
+ {
+ SET_BIT (b_outer, rp_b->region_number);
+ rp_b = rp_b->outer;
+ }
+ while (rp_b);
+
+ do
+ {
+ if (TEST_BIT (b_outer, rp_a->region_number))
+ {
+ sbitmap_free (b_outer);
+ return rp_a->region_number;
+ }
+ rp_a = rp_a->outer;
+ }
+ while (rp_a);
+
+ sbitmap_free (b_outer);
+ return -1;
+}
static int
t2r_eq (const void *pentry, const void *pdata)