Segmentation fault at end subroutine

I’m using Free PGI under OS X 10.7.5 (with XCode 4.6.3). The output from pgfortran -v is

pgfortran 14.3-0 64-bit target on Apple OS/X developer $INFOTPVAL
The Portland Group - PGI Compilers and Tools
Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved

The following code triggers a segmentation fault after write (,) “END SUBROUTINE”, but before write (,) “RETURNED OK”

module my_module

implicit none

!-----

type :: my_type

  type (my_type) , pointer :: next => null()

  contains

  procedure , pass :: f

end type

!-----

contains

!-----

  subroutine f( obj )

    class (my_type) , intent (inout) :: obj

  end subroutine

!-----

  subroutine process( obj )

    type (my_type) , intent (inout) , target :: obj

    !-----

    type (my_type) , pointer :: test => null()
    type (my_type) , pointer :: tmp  => null()

    !-----

    write (*,*) associated( obj % next )
    test => obj % next
    write (*,*) associated( test )

    call test % f()

    !-----

    write(*,*) "END SUBROUTINE"
  end subroutine

!-----

end module

!*****

program main

use my_module

implicit none

!-----

type (my_type) :: obj

allocate( obj % next )

call process( obj )
write (*,*) "RETURNED OK"

!-----

end program

I can’t see any reason for this, and the problem does not occur if gfortran or nagfor is used. Therefore I think this is a bug in pgfortran.

Hi Ian,

Thanks for the report. I’ll investigate this and see if I can reproduce the issue here. If so, then I’ll file a bug report with our developers. Will keep you posted.

Best regards,

+chris

TPR 20472 - Fortran code segfaults with method call
has been fixed as of the 14.7 release.

Thanks for the problem submission.

regards,
dave