mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 23:25:24 +02:00
Fortran: Fix check on locality spec DO CONCURRENT
PR fortran/122513 gcc/fortran/ChangeLog: * resolve.cc (check_default_none_expr): Do not allow an iterator in a locality spec. Allow a named constant to be used within the loop. gcc/testsuite/ChangeLog: * gfortran.dg/pr122513.f90: New test.
This commit is contained in:
committed by
Jerry DeLisle
parent
f8bb20167f
commit
ffe538c831
@@ -8461,7 +8461,20 @@ check_default_none_expr (gfc_expr **e, int *, void *data)
|
||||
break;
|
||||
ns2 = ns2->parent;
|
||||
}
|
||||
if (ns2 != NULL)
|
||||
|
||||
/* A DO CONCURRENT 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 "
|
||||
|
||||
13
gcc/testsuite/gfortran.dg/pr122513.f90
Normal file
13
gcc/testsuite/gfortran.dg/pr122513.f90
Normal file
@@ -0,0 +1,13 @@
|
||||
! { dg-do compile }
|
||||
! PR122513 do concurrent default (none) fails on parameter arrays
|
||||
program test
|
||||
implicit none
|
||||
integer :: i
|
||||
do concurrent (i=1:2) default (none)
|
||||
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
|
||||
Reference in New Issue
Block a user