]> gcc.gnu.org Git - gcc.git/commitdiff
re PR fortran/43339 (Incorrect output for pgm checking data sharing attributes)
authorJakub Jelinek <jakub@redhat.com>
Mon, 19 Apr 2010 21:51:28 +0000 (23:51 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 19 Apr 2010 21:51:28 +0000 (23:51 +0200)
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

gcc/fortran/ChangeLog
gcc/fortran/openmp.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/sharing-2.f90

index 61297f9f12c46537dab53abdb5ecee98318d2147..b9a4ebbcbd0e76bf21b2787ca4c8afed0277bb27 100644 (file)
@@ -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
index d60121c59291314b588ed4e734751ddeccf62b19..c00e1b41e28c092f80c4454414cadce74350a1b8 100644 (file)
@@ -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;
     }
 }
 
index d29867544e432c5acddf6a90169bb5de7799e46f..dbde6351fac0f9b2fae635648e8d23e3eacf97bc 100644 (file)
@@ -1,5 +1,10 @@
 2010-04-19  Jakub Jelinek  <jakub@redhat.com>
 
+       PR fortran/43339
+       * gfortran.dg/gomp/sharing-2.f90: Adjust for iteration vars
+       of sequential loops being private only in the innermost containing
+       task region.
+
        PR middle-end/43337
        * gfortran.dg/gomp/pr43337.f90: New test.
 
index aede06c9c0ff6e014b12c9cdbf042c799864166b..b7d7e0729754aa77a1711c1a8765958a76bbdb3e 100644 (file)
   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
@@ -68,8 +68,8 @@
     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)
This page took 0.087961 seconds and 5 git commands to generate.