https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122513
--- Comment #1 from kargls at comcast dot net ---
Thanks for the bug reports. Locality specs are rather new for gfortran,
so some bug may have slipped through testing. The following testcase
integer, parameter :: ii(2,3) = reshape([1,2,3,4,5,6], [2, 3])
integer i
do concurrent (i=1:2) default(none)
print *, ii(i,:)
end do
end
compiles with this patch.
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 0d5444848f0..20733af0ddc 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -8461,7 +8461,19 @@ check_default_none_expr (gfc_expr **e, int *, void
*data)
break;
ns2 = ns2->parent;
}
- if (ns2 != NULL)
+
+ /* A FORALL iterator cannot appear in a locality spec. */
+ if (sym->ns->code->ext.concur.forall_iterator)
+ {
+ gfc_forall_iterator *iter
+ = sym->ns->code->ext.concur.forall_iterator;
+ for (; iter; iter = iter->next)
+ if (strcmp(sym->name, iter->var->symtree->name) == 0)
+ return 0;
+ }
+
+ /* A named constant is not a variable, so skip test. */
+ if (ns2 != NULL && sym->attr.flavor != FL_PARAMETER)
{
gfc_error ("Variable %qs at %L not specified in a locality spec "
"of DO CONCURRENT at %L but required due to "
PS: Your code appears to have been types in from memory. The expression
'ii = reshape((/2, 3/), (/ 1,2,3,4,5,6 /)' is clearly wrong.