From 6ae70ea2e6f12a97415896b4721bf4df536e3b09 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 10 May 2011 08:08:18 +0200 Subject: [PATCH] re PR tree-optimization/48611 (ICE: SIGSEGV in remap_eh_region_nr (tree-inline.c:1194) with -Os -fopenmp -fexceptions -fno-tree-ccp -fno-tree-copy-prop on basic code) 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 | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/gomp/pr48611.f90 | 12 ++++++++++++ gcc/testsuite/gfortran.dg/gomp/pr48794.f90 | 12 ++++++++++++ gcc/tree-eh.c | 13 +++++++++++++ 5 files changed, 47 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/gomp/pr48611.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/pr48794.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0c0efe46aa6..b98c1231760 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2011-05-10 Jakub Jelinek + 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}. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index eb2f0735d1f..c63b45e58b5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2011-05-10 Jakub Jelinek + 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 index 00000000000..643cc5c3efe --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr48611.f90 @@ -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 index 00000000000..11edb0bb498 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr48794.f90 @@ -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 diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index cd6c428c172..e87c32e798b 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -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; + } } } -- 2.30.2