From: Thomas Koenig Date: Fri, 5 Jun 2015 20:51:08 +0000 (+0000) Subject: re PR fortran/66385 (ICE: FORALL writing multiple elements of one array) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9c3e121b01cd04ed96645f85d4587184d832a103;p=gcc.git re PR fortran/66385 (ICE: FORALL writing multiple elements of one array) 2015-06-05 Thomas Koenig PR fortran/66385 * frontend-passes.c (combine_array_constructor): Return early if inside a FORALL loop. 2015-06-05 Thomas Koenig PR fortran/66385 * gfortran.dg/forall_17.f90: New test. From-SVN: r224172 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c4958ee1d5f..35d3ce67be9 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2015-06-05 Thomas Koenig + + PR fortran/66385 + * frontend-passes.c (combine_array_constructor): Return early if + inside a FORALL loop. + 2015-06-05 Aldy Hernandez * f95-lang.c (gfc_write_global_declarations): Remove. diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 45b053e665b..3eda42f70a9 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -1243,6 +1243,10 @@ combine_array_constructor (gfc_expr *e) if (in_assoc_list) return false; + /* With FORALL, the BLOCKS created by create_var will cause an ICE. */ + if (forall_level > 0) + return false; + op1 = e->value.op.op1; op2 = e->value.op.op2; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 334d4091be8..e1a415ae5cd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-06-05 Thomas Koenig + + PR fortran/66385 + * gfortran.dg/forall_17.f90: New test. + 2015-06-05 Aldy Hernandez * g++.dg/cpp0x/pr57101.C: Add warning. diff --git a/gcc/testsuite/gfortran.dg/forall_17.f90 b/gcc/testsuite/gfortran.dg/forall_17.f90 new file mode 100644 index 00000000000..9b68d856840 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/forall_17.f90 @@ -0,0 +1,17 @@ +! { dg-do compile } +! { dg-options "-ffrontend-optimize" } +! PR fortran/66385 - this used to ICE +! Original test case by Mianzhi Wang +program test + double precision::aa(30) + double precision::a(3,3),b + b=1d0 + forall(i=1:3) + a(:,i)=b*[1d0,2d0,3d0] + end forall + + forall(i=1:10) + aa(10*[0,1,2]+i)=1d0 + end forall + +end program