re PR tree-optimization/48611 (ICE: SIGSEGV in remap_eh_region_nr (tree-inline.c...
authorJakub Jelinek <jakub@redhat.com>
Tue, 10 May 2011 06:08:18 +0000 (08:08 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 10 May 2011 06:08:18 +0000 (08:08 +0200)
PR tree-optimization/48611
PR tree-optimization/48794
* tree-eh.c (remove_unreachable_handlers): Don't remove regions
referenced from RESX or EH_DISPATCH arguments.

* gfortran.dg/gomp/pr48611.f90: New test.
* gfortran.dg/gomp/pr48794.f90: New test.

From-SVN: r173607

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/pr48611.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr48794.f90 [new file with mode: 0644]
gcc/tree-eh.c

index 0c0efe46aa6ccaee595b46b9002b3fa6d1a101be..b98c123176009cb4b76bc31ef5259888fbd144be 100644 (file)
@@ -1,5 +1,10 @@
 2011-05-10  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/48611
+       PR tree-optimization/48794
+       * tree-eh.c (remove_unreachable_handlers): Don't remove regions
+       referenced from RESX or EH_DISPATCH arguments.
+
        PR debug/48928
        * dfp.c (decimal_to_decnumber): Handle conversion from
        dconst{1,2,m1,half}.
index eb2f0735d1ffec7c6e16c50f33470bb6d8011e86..c63b45e58b54649cd82e049ddf85dce219a5d3fc 100644 (file)
@@ -1,5 +1,10 @@
 2011-05-10  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/48611
+       PR tree-optimization/48794
+       * gfortran.dg/gomp/pr48611.f90: New test.
+       * gfortran.dg/gomp/pr48794.f90: New test.
+
        PR debug/48928
        * gcc.dg/dfp/pr48928.c: New test.
 
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr48611.f90 b/gcc/testsuite/gfortran.dg/gomp/pr48611.f90
new file mode 100644 (file)
index 0000000..643cc5c
--- /dev/null
@@ -0,0 +1,12 @@
+! PR tree-optimization/48611
+! { dg-do compile }
+! { dg-options "-Os -fopenmp -fexceptions -fno-tree-ccp -fno-tree-copy-prop" }
+
+  integer, allocatable :: a(:)
+  logical :: l
+!$omp parallel private (a) reduction (.or.:l)
+  do i = 1, 7
+    a(:) = i
+  end do
+!$omp end parallel
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr48794.f90 b/gcc/testsuite/gfortran.dg/gomp/pr48794.f90
new file mode 100644 (file)
index 0000000..11edb0b
--- /dev/null
@@ -0,0 +1,12 @@
+! PR tree-optimization/48794
+! { dg-do compile }
+! { dg-options "-Os -fopenmp -fexceptions -fno-tree-ccp -fno-tree-copy-prop" }
+
+  integer, allocatable :: a(:)
+  logical :: l
+  if (allocated (a)) call abort
+!$omp parallel private (a) reduction (.or.:l)
+  do i = 1, 7
+  end do
+!$omp end parallel
+end
index cd6c428c1725a481a68acd3fb14444276dcf41ae..e87c32e798b2575df83e05daa94fc0fb751d3f8a 100644 (file)
@@ -3316,6 +3316,19 @@ remove_unreachable_handlers (void)
              SET_BIT (r_reachable, region->index);
              SET_BIT (lp_reachable, lp_nr);
            }
+
+         /* Avoid removing regions referenced from RESX/EH_DISPATCH.  */
+         switch (gimple_code (stmt))
+           {
+           case GIMPLE_RESX:
+             SET_BIT (r_reachable, gimple_resx_region (stmt));
+             break;
+           case GIMPLE_EH_DISPATCH:
+             SET_BIT (r_reachable, gimple_eh_dispatch_region (stmt));
+             break;
+           default:
+             break;
+           }
        }
     }