Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Strange OpenMP bug

fah10
New Contributor I
244 Views
Hi, I just want to report a very strange OpenMP related bug.
The program listed below produces random output within the parallel region, e.g.

> ifort -openmp omp_strange.F90 && OMP_NUM_THREADS=1 ./a.out
42
-261231752

The bug occurs with Intel Fortran 11.1 20101201
Versions 11.0 20090609 and 12.0.0 20101116 are not affected.

The following things seem to be necessary to reproduce the bug:
- the default initialization of the pointer in the derived type
- declaring a variable of type tt in the main program (which may be unused)
- parallel region in a subroutine with a local variable of type tt

Here's the code:

[fortran]program omp_strange
   implicit none

   type tt
      integer :: i
      integer, pointer :: ip => null()
   end type tt
   type(tt) :: unused_variable

   call test()

contains

   subroutine test
      type(tt) :: v

      v%i = 42
      print*,v%i

      !$omp parallel shared(v)
      print*,v%i
      !$omp end parallel
   end subroutine test
end program omp_strange[/fortran]





0 Kudos
1 Reply
Steven_L_Intel1
Employee
244 Views
If the problem is not in 12.0, it won't be looked at. Please use the current version. I tried this in the forthcoming Update 6 and it worked ok there as well.
0 Kudos
Reply