From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28135 invoked by alias); 26 Oct 2007 07:41:56 -0000 Received: (qmail 28073 invoked by uid 48); 26 Oct 2007 07:41:45 -0000 Date: Fri, 26 Oct 2007 07:41:00 -0000 Subject: [Bug fortran/33904] New: OpenMP: Default(shared) and wrong "lastprivate variable is private in outer context" X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-10/txt/msg02274.txt.bz2 Reported by Vasileios Liaskovitis, http://gcc.gnu.org/ml/fortran/2007-10/msg00339.html The following valid program gives "error: lastprivate variable "i2" is private in outer context" ------------------------------------ SUBROUTINE foo(a, b, n) DOUBLE PRECISION a, b INTEGER*8 i1, i2, i3, n DIMENSION a(n,n,n), b(n,n,n) !$OMP PARALLEL !$OMP+DEFAULT(SHARED) !$OMP+PRIVATE(I3) !$OMP DO !$OMP+LASTPRIVATE(I1,I2) DO i3 = 2, n-1, 1 DO i2 = 2, n-1, 1 DO i1 = 2, n-1, 1 a(i1, i2, i3) = b(i1, i2, i3); 600 CONTINUE ENDDO ENDDO ENDDO !$OMP END DO NOWAIT !$OMP END PARALLEL RETURN END ------------------------------------ Vasilis wrote: I believe this code is compliant with the OPENMP 2.5 spec, since the DEFAULT(SHARED) clause should make the scope of i1, i2 shared in the enclosing parallel region. Pathscale 3.0, PGI 7.0.6 and Intel 10.0.026 compile the above code successfully. Replacing: !$OMP+DEFAULT(SHARED) with: !$OMP+SHARED(I1,I2) makes the code compile successfully with gfortran. Alternatively, keeping DEFAULT(SHARED) and fusing the OMP PARALLEL clause with the OMP DO clause (i.e. using OMP PARALLEL DO) also solves the problem. (this testcase is derived from a benchmark suite that doesn't allow source code modifications. gfortran should be able to compile this with no code changes - if this is indeed openmp-compliant code) Could this behavior be due to the following libgomp patch not getting all necessary information from the fortran front-end? http://gcc.gnu.org/ml/gcc-patches/2007-01/msg01940.html -- Summary: OpenMP: Default(shared) and wrong "lastprivate variable is private in outer context" Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: rejects-valid, openmp Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33904