While it would be nice to support "!$OMP do" for "do concurrent" loops,
the OpenMP spec does not support it, yet. (Syntactically, it is a not a
that simple feature as do concurrent can optionally have a MASK=, which
has to be evaluated before the loop.)
Thus, this patch avoids an ICE by simply rejecting this feature. That's
also in line with the other compilers I tried: they either ICE or reject
it with an error message.
Note: The patch is based on Jakub's OpenMP4 patch (i.e. it uses "name"
instead of the hard-coded "!$omp do").
Build and regtested on x86-64-gnu-linux.
OK for the trunk? (When/if OpenMP4 support is backported, I think this
patch should also be included.)
Tobias
2014-05-11 Tobias Burnus <bur...@net-b.de>
PR fortran/60127
* openmp.c (resolve_omp_do): Reject do concurrent loops.
2014-05-11 Tobias Burnus <bur...@net-b.de>
PR fortran/60127
* gfortran.dg/gomp/omp_do_concurrent.f90: New.
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 16c7774..a578ad9 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -2169,6 +2169,12 @@ resolve_omp_do (gfc_code *code)
"at %L", name, &do_code->loc);
break;
}
+ if (do_code->op == EXEC_DO_CONCURRENT)
+ {
+ gfc_error ("%s cannot be a DO CONCURRENT loop at %L", name,
+ &do_code->loc);
+ break;
+ }
gcc_assert (do_code->op == EXEC_DO);
if (do_code->ext.iterator->var->ts.type != BT_INTEGER)
gfc_error ("%s iteration variable must be of type integer at %L",
diff --git a/gcc/testsuite/gfortran.dg/gomp/omp_do_concurrent.f90 b/gcc/testsuite/gfortran.dg/gomp/omp_do_concurrent.f90
new file mode 100644
index 0000000..8320479
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/omp_do_concurrent.f90
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! { dg-options "-fopenmp" }
+!
+! PR fortran/60127
+!
+! OpenMP 4.0 doesn't permit DO CONCURRENT (yet)
+!
+
+!$omp do
+do concurrent(i=1:5) ! { dg-error "OMP DO cannot be a DO CONCURRENT loop" }
+print *, 'Hello'
+end do
+end