+2010-04-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/43339
+ * openmp.c (gfc_resolve_do_iterator): Only make iteration vars for
+ sequential loops private in the innermost containing task region.
+
2010-04-18 Eric Botcazou <ebotcazou@adacore.com>
* f95-lang.c (gfc_init_decl_processing): Remove second argument in call
/* OpenMP directive matching and resolving.
- Copyright (C) 2005, 2006, 2007, 2008
+ Copyright (C) 2005, 2006, 2007, 2008, 2010
Free Software Foundation, Inc.
Contributed by Jakub Jelinek
void
gfc_resolve_do_iterator (gfc_code *code, gfc_symbol *sym)
{
- struct omp_context *ctx;
int i = omp_current_do_collapse;
gfc_code *c = omp_current_do_code;
c = c->block->next;
}
- for (ctx = omp_current_ctx; ctx; ctx = ctx->previous)
- {
- if (pointer_set_contains (ctx->sharing_clauses, sym))
- continue;
+ if (omp_current_ctx == NULL)
+ return;
- if (! pointer_set_insert (ctx->private_iterators, sym))
- {
- gfc_omp_clauses *omp_clauses = ctx->code->ext.omp_clauses;
- gfc_namelist *p;
+ if (pointer_set_contains (omp_current_ctx->sharing_clauses, sym))
+ return;
- p = gfc_get_namelist ();
- p->sym = sym;
- p->next = omp_clauses->lists[OMP_LIST_PRIVATE];
- omp_clauses->lists[OMP_LIST_PRIVATE] = p;
- }
+ if (! pointer_set_insert (omp_current_ctx->private_iterators, sym))
+ {
+ gfc_omp_clauses *omp_clauses = omp_current_ctx->code->ext.omp_clauses;
+ gfc_namelist *p;
+
+ p = gfc_get_namelist ();
+ p->sym = sym;
+ p->next = omp_clauses->lists[OMP_LIST_PRIVATE];
+ omp_clauses->lists[OMP_LIST_PRIVATE] = p;
}
}
end do
!$omp end single
!$omp end parallel
-!$omp parallel default (none) shared (a)
- i = 1
- j = 1
- k = 1
+!$omp parallel default (none) shared (a) ! { dg-error "enclosing parallel" }
+ i = 1 ! { dg-error "not specified in" }
+ j = 1 ! { dg-error "not specified in" }
+ k = 1 ! { dg-error "not specified in" }
!$omp parallel default (none) shared (a)
i = 1
j = 1
a(i, 1) = i + 1
end do
!$omp end parallel
-!$omp parallel default (none) shared (a)
- i = 1
+!$omp parallel default (none) shared (a) ! { dg-error "enclosing parallel" }
+ i = 1 ! { dg-error "not specified in" }
!$omp parallel default (none) shared (a, i)
i = 2
!$omp parallel default (none) shared (a)