diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-04-19 23:51:28 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-04-19 23:51:28 +0200 |
commit | 310e44721056e49ef306847d4dc128cd9b736077 (patch) | |
tree | 0d30e48f995fb8fd50a8c3b308cc3360a4071a89 /gcc/fortran | |
parent | fd2e4e99d810ae5f0ecac7954db4602343ca2ec7 (diff) | |
download | gcc-310e44721056e49ef306847d4dc128cd9b736077.zip gcc-310e44721056e49ef306847d4dc128cd9b736077.tar.gz gcc-310e44721056e49ef306847d4dc128cd9b736077.tar.bz2 |
re PR fortran/43339 (Incorrect output for pgm checking data sharing attributes)
PR fortran/43339
* openmp.c (gfc_resolve_do_iterator): Only make iteration vars for
sequential loops private in the innermost containing task region.
* gfortran.dg/gomp/sharing-2.f90: Adjust for iteration vars
of sequential loops being private only in the innermost containing
task region.
From-SVN: r158528
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/openmp.c | 29 |
2 files changed, 20 insertions, 15 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 61297f9..b9a4ebb 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +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 diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index d60121c..c00e1b4 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -1,5 +1,5 @@ /* 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 @@ -1367,7 +1367,6 @@ gfc_resolve_omp_parallel_blocks (gfc_code *code, gfc_namespace *ns) 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; @@ -1386,21 +1385,21 @@ gfc_resolve_do_iterator (gfc_code *code, gfc_symbol *sym) 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; } } |