static void
show_iterator (gfc_namespace *ns)
{
- for (gfc_symbol *sym = ns->proc_name; sym; sym = sym->tlink)
+ for (gfc_symbol *sym = ns->omp_affinity_iterators; sym; sym = sym->tlink)
{
gfc_constructor *c;
- if (sym != ns->proc_name)
+ if (sym != ns->omp_affinity_iterators)
fputc (',', dumpfile);
fputs (sym->name, dumpfile);
fputc ('=', dumpfile);
/* !$ACC ROUTINE clauses. */
gfc_omp_clauses *oacc_routine_clauses;
+ /* !$ACC TASK AFFINITY iterator symbols. */
+ gfc_symbol *omp_affinity_iterators;
+
/* !$ACC ROUTINE names. */
gfc_oacc_routine_name *oacc_routine_names;
if (last)
last->tlink = sym;
else
- (*ns)->proc_name = sym;
+ (*ns)->omp_affinity_iterators = sym;
last = sym;
sym->declared_at = prev_loc;
sym->ts = ts;
&& n->u2.ns && !n->u2.ns->resolved)
{
n->u2.ns->resolved = 1;
- for (gfc_symbol *sym = n->u2.ns->proc_name; sym;
- sym = sym->tlink)
+ for (gfc_symbol *sym = n->u2.ns->omp_affinity_iterators;
+ sym; sym = sym->tlink)
{
gfc_constructor *c;
c = gfc_constructor_first (sym->value->value.constructor);
&& sym->ns->proc_name->attr.flavor == FL_LABEL)
/* This is a BLOCK construct. */
add_decl_as_local (decl);
+ else if (sym->ns->omp_affinity_iterators)
+ /* This is a block-local iterator. */
+ add_decl_as_local (decl);
else
gfc_add_decl_to_parent_function (decl);
}
handle_iterator (gfc_namespace *ns, stmtblock_t *iter_block, tree block)
{
tree list = NULL_TREE;
- for (gfc_symbol *sym = ns->proc_name; sym; sym = sym->tlink)
+ for (gfc_symbol *sym = ns->omp_affinity_iterators; sym; sym = sym->tlink)
{
gfc_constructor *c;
gfc_se se;
!$omp end task
end
! { dg-final { scan-tree-dump-times "= ibar \\(&C\\." 3 "gimple" } }
-! { dg-final { scan-tree-dump-times "= ibar \\(j\\." 1 "gimple" } }
+! { dg-final { scan-tree-dump-times "= ibar \\(&j" 1 "gimple" } }
--- /dev/null
+! This program used to ICE in convert_nonlocal_reference_op due to
+! incorrect scoping of AFFINITY clause iterator variables.
+
+program p
+ integer :: a(8)
+ !$omp task affinity (iterator(j=1:8) : a(j))
+ !$omp end task
+contains
+ integer function f(x)
+ class(*) :: x
+ end
+end
--- /dev/null
+! This test case used to ICE in verify_ssa due to the iterator variable j
+! incorrectly being inserted into program scope.
+
+program p
+ integer :: i
+ do i = 1, 3
+ call sub (s(i))
+ end do
+contains
+ function s(n) result(z)
+ integer, target, intent(in) :: n
+ integer, pointer :: z
+ integer :: a(8), b(8), c(8)
+ !$omp task affinity (iterator(j=1:8) : a(j), b(j), c(j))
+ !$omp end task
+ z => n
+ end
+end