PGI Fortran: Internal Compiler Error

Dear PGI support,

the current PGI compiler (17.4) crashes when compiling code, which calls move_alloc() on derived types.

  subroutine GeoOpt_initConjGrad(self, pConjGrad)
    type(OGeoOpt), intent(out) :: self
    type(OConjGrad), allocatable, intent(inout) :: pConjGrad

    call move_alloc(pConjGrad, self%pConjGrad)

  end subroutine GeoOpt_initConjGrad

with

  type OGeoOpt
    private
    type(OConjGrad), allocatable :: pConjGrad
  end type OGeoOpt

and

  type OConjGrad
    private
    integer :: state
    integer :: nElem
    real(dp), allocatable :: gg(:)
    :
  end type OConjGrad

.

The full example can be found in the DFTB+ repository :

If I replace all move_allocs() with explicit allocate, assignment and deallocate statements, the program compiles, but then immediately segfaults at start (probably unrelated to this problem). All other compilers I’ve tried (ifort 2016, nag 6.1, GNU 5.4 - 7.1) have no problems with it.

Best regards,

Bálint

The links you provided do not provide all the modfiles needed (like assert.mod) and I am not sure of the steps needed to create the
source files (.f90) from the preprocessed sources (.F90)

If you could provide the files that can be compiled and create the
errors indicated, that would help.

dave

OK, below you find an extracted minimal working example. Compiling it with

pgfortran -c bug.f90

results in

ILM file: can't find intrinsic ..sqrt
ILM file line 203: unknown symbol operand 1
PGF90-F-0000-Internal compiler error. Errors in ILM file       2 (bug.f90)
PGF90/x86-64 Linux 17.4-0: compilation aborted

Best regards,

Bálint

module mod1
  implicit none
  private

  public :: SomeType

  type :: SomeType
  end type SomeType

end module mod1


module mod2
  use mod1
  private

  type :: TypeWrapper
    type(SomeType), allocatable :: instance
  end type TypeWrapper

  public :: wrap

contains


  subroutine wrap(this, instance)
    type(TypeWrapper), intent(out) :: this
    type(SomeType), allocatable, intent(inout) :: instance

    call move_alloc(instance, this%instance)

  end subroutine wrap

end module mod2

Thanks for that - it demonstrated a problem that has been logged as TPR 24494. When I comment out move_alloc, the code compiles.

dave

24494 - pgfortran ICE " Errors in ILM file" “ILM file: can’t find intrinsic …sqrt”
is fixed in the current 18.1 release.

dave