re PR tree-optimization/31769 (ICE with OpenMP and exceptions)
authorJakub Jelinek <jakub@redhat.com>
Wed, 30 May 2007 13:46:25 +0000 (15:46 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 30 May 2007 13:46:25 +0000 (15:46 +0200)
PR tree-optimization/31769
* except.c (duplicate_eh_regions): Clear prev_try if
ERT_MUST_NOT_THROW region is inside of ERT_TRY region.

* g++.dg/gomp/pr31769.C: New test.

From-SVN: r125183

gcc/ChangeLog
gcc/except.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/gomp/pr31769.C [new file with mode: 0644]

index 3030d3ccd00c70a2a59e9d9b6ece05221b0a6be8..9229ee17656b7a514d73956bd04934eead6aefeb 100644 (file)
@@ -1,3 +1,9 @@
+2007-05-30  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/31769
+       * except.c (duplicate_eh_regions): Clear prev_try if
+       ERT_MUST_NOT_THROW region is inside of ERT_TRY region.
+
 2007-05-30  Zdenek Dvorak  <dvorakz@suse.cz>
 
        * tree-scalar-evolution.c (scev_const_prop): Do not create labels.
index 29a28d7154648b0dd453a8e31d0b1cb09a63a6ba..b360ae4ad1da7f63ed76ac99b5a76a3efe1dc6fd 100644 (file)
@@ -1005,7 +1005,11 @@ duplicate_eh_regions (struct function *ifun, duplicate_eh_regions_map map,
     for (prev_try = VEC_index (eh_region, cfun->eh->region_array, outer_region);
          prev_try && prev_try->type != ERT_TRY;
         prev_try = prev_try->outer)
-      ;
+      if (prev_try->type == ERT_MUST_NOT_THROW)
+       {
+         prev_try = NULL;
+         break;
+       }
 
   /* Remap all of the internal catch and cleanup linkages.  Since we 
      duplicate entire subtrees, all of the referenced regions will have
index d69c0d748e13a068a9749db80b5c9926e0c16282..84d379a380a90301e93e23770ff0fbc62a2cd54b 100644 (file)
@@ -1,3 +1,8 @@
+2007-05-30  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/31769
+       * g++.dg/gomp/pr31769.C: New test.
+
 2007-05-29  Hui-May Chang  <hm.chang@apple.com>
 
        * gcc.target/i386/stack-realign.c: New.
diff --git a/gcc/testsuite/g++.dg/gomp/pr31769.C b/gcc/testsuite/g++.dg/gomp/pr31769.C
new file mode 100644 (file)
index 0000000..54945f9
--- /dev/null
@@ -0,0 +1,61 @@
+// PR tree-optimization/31769
+// { dg-options "-O2 -fopenmp" }
+// { dg-do compile }
+
+struct B
+{
+  B () {}
+  virtual ~B () {}
+};
+struct C
+{
+  C (int x, int y) {}
+};
+template<typename T, int U>
+struct D
+{
+  D () {}
+  ~D () {}
+};
+struct E
+{
+  E () {}
+  ~E () {}
+  D<int, 1> e;
+};
+struct A
+{
+  B *b;
+  A () { b = __null; }
+  ~A () { if (b != __null) delete b; }
+};
+struct F : public A
+{
+  explicit F (int x) { foo (0); }
+  F (const F &x) {}
+  F (F &x, C y) {}
+  F operator () (C x) const
+  {
+    return F (const_cast<F &>(*this), x);
+  }
+  template <typename U> F & operator+= (const U &);
+  void foo (int);
+  E f;
+};
+
+int
+main ()
+{
+  try
+  {
+    F f (10);
+    F g (10);
+    C h (0, 9);
+#pragma omp parallel for
+    for (int i = 0; i < 2; ++i)
+      g += f (h);
+  }
+  catch (int &e)
+  {
+  }
+}