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/30676] New: Incomplete warning on non-conforming code with -fopenmp


Compiling the following invalid OpenMP program with -Wall results in no warning
message at -O0 and a poorly-formed warning message at -O1 or higher.  No
warning is printed at any optimization level if compiled without -Wall.

The program violates the constraint on allocatable arrays in private clauses
given near the end of section 2.8.3.3 of the OpenMP API manual v2.5:
allocatable arrays in private clauses must be unallocated on entry and exit to
the parallel region.  The Fortran frontend should detect this violation and
issue a fully-formed warning (or error) regardless of optimization level.

taylor@host $ cat test.f 
      program test
      integer :: i
      integer, allocatable :: array(:)
      allocate(array(200))
!$omp parallel do private(i,array)
      do i = 1, 100
        array(i) = i
      end do
      end program

taylor@host $ gfortran -Wall -O0 -fopenmp test.f -o test

taylor@host $ gfortran -Wall -O1 -fopenmp test.f -o test
'array.dim[0].stridetest.f: In function 'MAIN__.omp_fn.0':
test.f:5: warning: ' is used uninitialized in this function
'array.offsettest.f:5: warning: ' is used uninitialized in this function

taylor@host $ gfortran -O1 -fopenmp test.f -o test

taylor@host $ gfortran -v
Using built-in specs.
Target: powerpc-apple-darwin8.8.0
Configured with: ../gcc-4.3-20061223/configure --enable-languages=fortran
Thread model: posix
gcc version 4.3.0 20061223 (experimental)


-- 
           Summary: Incomplete warning on non-conforming code with -fopenmp
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: spam dot brian dot taylor at gmail dot com
  GCC host triplet: powerpc-apple-darwin8.8.0
GCC target triplet: powerpc-apple-darwin8.8.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30676


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