Mark DO CONCURRENT iterators created via a type-spec as referenced so that
generated shadow names are not warned about under -Wall.
PR fortran/96255
gcc/fortran/ChangeLog:
* match.cc (apply_typespec_to_iterator): Call gfc_set_sym_referenced
for both new and shadow iterator symbols.
gcc/testsuite/ChangeLog:
* gfortran.dg/do_concurrent_typespec_1.f90: Update testcase to check
for bugus warnings.
/* Variable not declared in outer scope - just set the type. */
v->ts.type = v->symtree->n.sym->ts.type = BT_INTEGER;
v->ts.kind = v->symtree->n.sym->ts.kind = ts->kind;
+ gfc_set_sym_referenced (v->symtree->n.sym);
}
else
{
v->symtree = st;
gfc_replace_expr (iter->var, v);
iter->shadow = true;
+ gfc_set_sym_referenced (st->n.sym);
}
/* Convert iterator bounds to the specified type. */
! { dg-do run }
-! { dg-options "-std=f2008" }
+! { dg-options "-std=f2008 -Wall" }
+! { dg-bogus "Unused variable '_i' declared" }
+! { dg-bogus "Unused variable '_k' declared" }
+! { dg-bogus "Unused variable 'n' declared" }
!
! PR fortran/96255
! Test DO CONCURRENT with optional type specification
call test_multiple_iterators()
test_count = test_count + 1
- print *, "All", test_count, "tests passed"
-
contains
subroutine test_no_outer_var()