From e0eb05eaa18608b8aacd94d1c74ceac2ea581191 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 26 Apr 2007 09:29:46 +0200 Subject: [PATCH] re PR tree-optimization/30558 (ICE with OpenMP and exceptions) PR tree-optimization/30558 * tree-eh.c (lower_eh_filter): If EH_FILTER_MUST_NOT_THROW clear this_state.prev_try. * g++.dg/gomp/pr30558.C: New test. From-SVN: r124177 --- gcc/ChangeLog | 6 +++++ gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/g++.dg/gomp/pr30558.C | 41 +++++++++++++++++++++++++++++ gcc/tree-eh.c | 4 +++ 4 files changed, 56 insertions(+) create mode 100644 gcc/testsuite/g++.dg/gomp/pr30558.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ad1928a2784..b99d5272091 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-04-26 Jakub Jelinek + + PR tree-optimization/30558 + * tree-eh.c (lower_eh_filter): If EH_FILTER_MUST_NOT_THROW + clear this_state.prev_try. + 2007-04-26 Richard Sandiford Mark Mitchell diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 04a98ad3488..d75284ce407 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-04-26 Jakub Jelinek + + PR tree-optimization/30558 + * g++.dg/gomp/pr30558.C: New test. + 2007-04-24 Mark Mitchell PR c++/31338 diff --git a/gcc/testsuite/g++.dg/gomp/pr30558.C b/gcc/testsuite/g++.dg/gomp/pr30558.C new file mode 100644 index 00000000000..e4929220b81 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr30558.C @@ -0,0 +1,41 @@ +// PR tree-optimization/30558 +// { dg-do compile } +// { dg-options "-fopenmp" } + +template struct F +{ + ~F (); + F (T); + const T &operator[] (unsigned i) const; +}; + +template F foo (const F &x) +{ + return F (x[1]); +} + +struct G +{ + G () { bar (2); } + F &operator () (F x); + void bar (int); +}; + +int +main () +{ + try + { + G g; +#pragma omp parallel for + for (int i = 0; i < 10; ++i) + { + F j (i); + F f = g (j); + F h = foo (f); + } + } + catch (int &e) + { + } +} diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index edd17cbcf61..37fce85eb29 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -1497,6 +1497,10 @@ lower_eh_filter (struct leh_state *state, tree *tp) EH_FILTER_TYPES (inner)); this_state = *state; this_state.cur_region = this_region; + /* For must not throw regions any cleanup regions inside it + can't reach outer catch regions. */ + if (EH_FILTER_MUST_NOT_THROW (inner)) + this_state.prev_try = NULL; lower_eh_constructs_1 (&this_state, &TREE_OPERAND (*tp, 0)); -- 2.30.2