Bug??

Hi PG Team,

this code leads to a segfault when compiled while the “Private :: SubSet” statment is uncommented.

Module Mod1
  Type :: T1
    integer :: a
  contains
    Procedure, pAss :: set=>subset
  End type T1
  !Private :: SubSet
contains
  Subroutine SubSet(this)
    Class(T1), Intent(InOut) :: this
    this%a=5
  End Subroutine SubSet
End Module Mod1
Program Test
  use Mod1
  Type(T1) :: a
  call a%Set()
  write(*,*) a%a
End Program Test

I am not 100% familiar with the 2008 language standard, but from using other compilers I think this behaviour is not correct.

Cheers

Thanks vb86. I’ve created a problem report (TPR#22712) and sent it off to engineering for further investigation. As a work around, you can add “public” to the “set” procedure.

% cat bug.f90
Module Mod1
  Type :: T1
    integer :: a
  contains
    Procedure, pass, public :: set=>subset
  End type T1
  Private :: SubSet
contains
  Subroutine SubSet(this)
    Class(T1), Intent(InOut) :: this
    this%a=5
  End Subroutine SubSet
End Module Mod1
Program Test
  use Mod1
  Type(T1) :: a
  call a%Set()
  write(*,*) a%a
End Program Test
% pgfortran bug.f90
% a.out
            5

Thanks again,
Mat

*22712 - User code seg faults when using tbp with private implementation *

has been fixed in the currently released 17.1 compilers.

thanks,
dave