This is the mail archive of the gcc-bugs@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]

[Bug fortran/35131] New: OpenMP: Private variable passed to subroutine


As reported by Ignacio Fernández Galván, the following program prints with
"gfortran -fopenmp" 0.0 instead of 42.0. Without -fopenmp or using, e.g., ifort
or sunf95 42.0 is printed.

See also http://gcc.gnu.org/ml/fortran/2008-02/msg00058.html

I believe the program is valid, compare also
http://www.openmp.org/pipermail/omp/2006/000532.html

PROGRAM Outer
 IMPLICIT NONE
 REAL, DIMENSION(20) :: A
 INTEGER :: k
 A = 0.0
!$OMP PARALLEL DO PRIVATE(k)
 DO k=1,SIZE(A)
   CALL Inner(k)
 END DO
!$OMP END PARALLEL DO
 print *, A
CONTAINS
 SUBROUTINE Inner(i)
   IMPLICIT NONE
   INTEGER :: i
   A(i) = 42
 END SUBROUTINE Inner
END PROGRAM Outer


-- 
           Summary: OpenMP: Private variable passed to subroutine
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code, 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=35131


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