flang-compiler / flang

Flang is a Fortran language front-end designed for integration with LLVM.
Other
799 stars 134 forks source link

ICE when OpenMP private variable is a pointer #627

Open mgduda opened 5 years ago

mgduda commented 5 years ago

When the private list for an OpenMP do clause contains a pointer, as in this example code:

program threadptr

   type comm_list_type
       type (comm_list_type), pointer :: next => null()
   end type comm_list_type

   type (comm_list_type), pointer :: commListPtr
   integer :: i

   !$omp do private(commListPtr)
   do i = 1, 1
       commListPtr => commListPtr % next
   end do
   !$omp end do

end program threadptr

the following ICE occurs:

F90-F-0000-Internal compiler error. print_token(): missing token       0  (threadptr.f90: 16)
mgduda commented 5 years ago

When enclosing !$omp parallel and !$omp end parallel directives are added to the example code, the ICE disappears. However, in actual applications, the parallel directives might be given around a section of code in another compilation unit that calls code like that in the example.