]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/66385 (ICE: FORALL writing multiple elements of one array)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 18 Oct 2015 11:29:37 +0000 (11:29 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 18 Oct 2015 11:29:37 +0000 (11:29 +0000)
2015-10-18  Thomas Koenig  <tkoenig@gcc.gnu.org>

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

2015-10-18  Thomas Koenig  <tkoenig@gcc.gnu.org>

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

From-SVN: r228943

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

index 4398d805e590b0faf340a9ecc3fb238fa47abe64..40b2dc38f8ad6134c288a26d8a45bb52f8121207 100644 (file)
@@ -1,3 +1,10 @@
+2015-10-18  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       Backport from trunk
+       PR fortran/66385
+       * frontend-passes.c (combine_array_constructor): Return early if
+       inside a FORALL loop.
+
 2015-08-07  Mikael Morin  <mikael@gcc.gnu.org>
 
        PR fortran/66929
index 23a8ece17ee8b99240343caac5b4e3f523c56e14..518a80a5c602589a4d12e24e047502b11111471e 100644 (file)
@@ -1088,6 +1088,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 0250c07799468f6271348b0157106cc4d3a34279..0849fd4e4cc46ab89148eee50d723cf8a0dc1937 100644 (file)
@@ -1,3 +1,9 @@
+2015-10-18  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       Backport from trunk
+       PR fortran/66385
+       * gfortran.dg/forall_17.f90:  New test.
+
 2015-10-01  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.dg/lto/pr55113_0.c: Skip on all x86 targets.
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