Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

Allocation status of intent(out) dummy arguments with -qopenmp flags

$
0
0

Hi there,

have a look at the following code

Module ModTmp
contains
  Subroutine SubA(CSIn,CVOut)
    Implicit None
    Character(len=*), Intent(In) :: CSIn
    Character(len=len(CSIn)), Intent(Out), Allocatable :: CVOut(:)
    write(*,*) allocated(CVOut)
  End Subroutine SubA
   Subroutine SubB()
     Implicit None
     Integer(kind=8) :: c1
     !$OMP PARALLEL
     !$OMP DO PRIVATE(c1)
     Do c1=1,2
     End Do
     !$OMP END DO
     !$OMP END PARALLEL
   end Subroutine SubB
end Module ModTmp
Program Test
  use ModTmp
  Character(len=20) :: CSTmp
  Character(len=20), Allocatable :: CVOut(:)
  call SubA(CSTmp,CVout)
  write(*,*) allocated(CVOut)
end Program Test

If I compile this with

ifort -mkl -warn nounused -warn declarations -static -O3 -parallel -qopenmp

the allocation status of "cvout" in SubA changes according to whether I comment or uncomment the openmp statements in SubB.

If uncommented, "allocated(CVOut)" yields "T", if commented "allocated(CVOut)" yields "F" (as expected). This does not happen if CVOut is declared with (len=*) in SubA.

I am doing anything wrong here???

Can anybody comment on this.

Thanks a lot

Karl

NB: ifort 16.0.2, linux 4.2.0-35

 


Viewing all articles
Browse latest Browse all 2583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>