re PR fortran/66385 (ICE: FORALL writing multiple elements of one array)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Fri, 5 Jun 2015 20:51:08 +0000 (20:51 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Fri, 5 Jun 2015 20:51:08 +0000 (20:51 +0000)
2015-06-05  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/66385
* frontend-passes.c (combine_array_constructor): Return early if
inside a FORALL loop.

2015-06-05  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/66385
* gfortran.dg/forall_17.f90:  New test.

From-SVN: r224172

gcc/fortran/ChangeLog
gcc/fortran/frontend-passes.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/forall_17.f90 [new file with mode: 0644]

index c4958ee1d5fc7fb53c85a5e4a3c78f0753317c04..35d3ce67be9e9c94cd837863fa818dbbd6135dac 100644 (file)
@@ -1,3 +1,9 @@
+2015-06-05  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/66385
+       * frontend-passes.c (combine_array_constructor): Return early if
+       inside a FORALL loop.
+
 2015-06-05  Aldy Hernandez  <aldyh@redhat.com>
 
        * f95-lang.c (gfc_write_global_declarations): Remove.
index 45b053e665b8f09d678e9f8cfff34bf64f2ba4d8..3eda42f70a9a3f6c60275ae3d2d01e4657b109b3 100644 (file)
@@ -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;
 
index 334d4091be8d7fc2bfb8116e8d5787222e05f32d..e1a415ae5cd0653d6f3cb4db6b3cb9a7f453d7c4 100644 (file)
@@ -1,3 +1,8 @@
+2015-06-05  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/66385
+       * gfortran.dg/forall_17.f90:  New test.
+
 2015-06-05  Aldy Hernandez  <aldyh@redhat.com>
 
        * 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 (file)
index 0000000..9b68d85
--- /dev/null
@@ -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