This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix OpenMP non-local private var in nested task (PR middle-end/43337)


Hi!

For private vars saying that they need CHAIN.N decl is not only a waste,
but in nested task (explicit or implicit) regions it even leads to ICEs
if no other var leads to marking the CHAIN.N decl needed in the outer
task region, just in the inner one.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux.
Committed to trunk, will commit tomorrow to 4.5/4.4 after
bootstrapping/regtesting there.

2010-04-19  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/43337
	* tree-nested.c (convert_nonlocal_omp_clauses): OMP_CLAUSE_PRIVATE
	with non-local decl doesn't need chain.

	* gfortran.dg/gomp/pr43337.f90: New test.

--- gcc/tree-nested.c.jj	2009-11-25 16:47:37.000000000 +0100
+++ gcc/tree-nested.c	2010-04-19 17:35:18.000000000 +0200
@@ -1,5 +1,5 @@
 /* Nested function decomposition for GIMPLE.
-   Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
+   Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
    This file is part of GCC.
@@ -1088,7 +1088,8 @@ convert_nonlocal_omp_clauses (tree *pcla
 	    {
 	      bitmap_set_bit (new_suppress, DECL_UID (decl));
 	      OMP_CLAUSE_DECL (clause) = get_nonlocal_debug_decl (info, decl);
-	      need_chain = true;
+	      if (OMP_CLAUSE_CODE (clause) != OMP_CLAUSE_PRIVATE)
+		need_chain = true;
 	    }
 	  break;
 
--- gcc/testsuite/gfortran.dg/gomp/pr43337.f90.jj	2010-04-19 17:40:39.000000000 +0200
+++ gcc/testsuite/gfortran.dg/gomp/pr43337.f90	2010-04-19 17:40:13.000000000 +0200
@@ -0,0 +1,30 @@
+! PR middle-end/43337
+! { dg-do compile }
+! { dg-options "-fopenmp -O2 -g" }
+
+subroutine pr43337
+  integer :: a, b(10)
+  call foo (b)
+  call bar (b)
+contains
+  subroutine foo (b)
+    integer :: b(10)
+!$omp parallel if (.false.)
+!$omp task if (.false.) shared(b)
+    do a = 1, 10
+      b(a) = 1
+    end do
+!$omp end task
+!$omp end parallel
+  end subroutine foo
+  subroutine bar (b)
+    integer :: b(10)
+!$omp parallel if (.false.)
+!$omp parallel if (.false.)
+    do a = 1, 10
+      b(a) = 1
+    end do
+!$omp end parallel
+!$omp end parallel
+  end subroutine bar
+end subroutine pr43337

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]