Hi! The parsing of !$omp workshare requires only small precise set of statements that can appear inside, which the inlining of matmul assign breaks.
Fixed by disabling the inlining in !$omp workshare regions. Long term, it would be nice to inline those in !$omp workshare again and actually parallelize, but I guess in that case it should not be done during frontend passes, but during workshare translation into generic - and would need to arrange for proper worksharing of both of the actions (clearing of the target array as well as actually computing it). Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk and 6.2. 2016-05-11 Jakub Jelinek <ja...@redhat.com> PR fortran/70855 * frontend-passes.c (inline_matmul_assign): Disable in !$omp workshare. * gfortran.dg/gomp/pr70855.f90: New test. --- gcc/fortran/frontend-passes.c.jj 2016-02-29 19:33:09.000000000 +0100 +++ gcc/fortran/frontend-passes.c 2016-05-11 11:54:43.747298277 +0200 @@ -2812,6 +2812,12 @@ inline_matmul_assign (gfc_code **c, int 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 --- gcc/testsuite/gfortran.dg/gomp/pr70855.f90.jj 2016-05-11 12:03:37.627977013 +0200 +++ gcc/testsuite/gfortran.dg/gomp/pr70855.f90 2016-05-11 12:04:06.927575148 +0200 @@ -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 Jakub