https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122513
--- Comment #4 from kargls at comcast dot net ---
(In reply to kargls from comment #3)
> (In reply to Alexander Heger from comment #2)
> > My apologies, I forgot to update my test code on the post
> >
> > program test
> > implicit none
> > integer :: i
> > do concurrent (i=1:2) default (none) local(i)
> > block
> > integer, dimension(2,3), parameter :: &
> > ii = reshape((/ 1,2,3,4,5,6 /), (/2, 3/))
> > print*,ii(i,:)
> > end block
> > end do
> > end program test
>
> We would rather have bug reports with minor imperfections
> than no report at all!
>
> Your new test here defeats the quick and dirty patch in
> my comment #1. BLOCK is a namespace nested within the
> DO CONCURRENT construct, so the patch needs to look at
> symbols from the parent namespace as well. Need to
> think about how to skip an iterator for a parent
> namespace.
Revised patch. This works with your new testcase.
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 0d5444848f0..2b5f58f7e7f 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -8461,7 +8461,20 @@ 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 (iter->var->symtree
+ && 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 "