Returning allocatable array of pointers causes segfault

The following test program compiles with pgfortran 11.3.0 64.bit, but segfaults somewhere around the return from function initallocarray. Using a subroutine instead of the function would solve the issue, but unfortunately is not an option in our code.
Additionally, using gfortran 4.4+ and ifort 11.0+ the code compiles and runs without segfaulting.

program test
  type allocptr
    integer, pointer :: this => null()
  end type allocptr

  type allocarray
    type(allocptr), allocatable, dimension(:) :: terms
  end type allocarray

  type(allocarray) :: a
  a = initallocarray(10)

contains

  type(allocarray) function initallocarray(dim)
    integer, intent(in) :: dim
    allocate(initallocarray%terms(dim))
  end function initallocarray
end program

Compiler:
$ pgfortran -V
pgfortran 11.3-0 64-bit target on x86-64 Linux -tp shanghai

Architecture:
Linux hopper07 2.6.27.48-0.12-default #1 SMP 2010-09-20 11:03:26 -0400 x86_64 x86_64 x86_64 GNU/Linux

Any help would be greatly appreciated! Thanks in advance!

Katharina,


We replicated your behavior and assigned the problem TPR 18149.


regards,
dave