re PR fortran/70855 (ICE with -fopenmp in gfc_trans_omp_workshare(): Bad statement...
authorJakub Jelinek <jakub@redhat.com>
Wed, 11 May 2016 13:16:48 +0000 (15:16 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 11 May 2016 13:16:48 +0000 (15:16 +0200)
PR fortran/70855
* frontend-passes.c (inline_matmul_assign): Disable in !$omp workshare.

* gfortran.dg/gomp/pr70855.f90: New test.

From-SVN: r236119

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

index f683869f8c39f5e902249ad6feb708d56c103a25..3d79fcaec214c6c5f637b0f34495aeeb55dcab8b 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/70855
+       * frontend-passes.c (inline_matmul_assign): Disable in !$omp workshare.
+
 2016-05-09  Richard Biener  <rguenther@suse.de>
 
        PR fortran/70937
index 7eeb5a68aa2bdf54b2eaf7d0916f995e344565ac..9d724dec0cd1a133aee23fa8bd00e1882ca904b1 100644 (file)
@@ -2812,6 +2812,12 @@ inline_matmul_assign (gfc_code **c, int *walk_subtrees,
   if (in_where)
     return 0;
 
+  /* For now don't do anything in OpenMP workshare, it confuses
+     its translation, which expects only the allowed statements in there.
+     We should figure out how to parallelize this eventually.  */
+  if (in_omp_workshare)
+    return 0;
+
   expr1 = co->expr1;
   expr2 = co->expr2;
   if (expr2->expr_type != EXPR_FUNCTION
index 12fd1d05fbeeeaf193a8c4cdf912fabf97e96bd4..019087254e0fabf12b9ce72b0eba0273d162eda8 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/70855
+       * gfortran.dg/gomp/pr70855.f90: New test.
+
 2016-05-11  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/71002
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr70855.f90 b/gcc/testsuite/gfortran.dg/gomp/pr70855.f90
new file mode 100644 (file)
index 0000000..247e4ed
--- /dev/null
@@ -0,0 +1,18 @@
+! PR fortran/70855
+! { dg-do compile }
+! { dg-additional-options "-O2" }
+
+program pr70855
+   integer, parameter :: m = 4
+   integer, parameter :: n = 2
+   real :: a(m,n)
+   real :: x(n)
+   real :: y(m)
+   a = 1.0
+   x = 1.0
+!$omp parallel
+!$omp workshare
+   y(1:m) = matmul ( a(1:m,1:n), x(1:n) )
+!$omp end workshare
+!$omp end parallel
+end program pr70855