Severe error when overriding abstract type in Fortran

It appears that when you have an abstract type with a deferred type-bound function that returns a character variable that is of length determined by an input argument, and this deferred function is overridden in an extended type, the PGI compiler fails to compile it and gives a severe error. Here is a small code example:

module pgi_override_char_param

  type, abstract :: parent
    procedure(iName), nopass, deferred :: name
  end type parent

  abstract interface
    function iName(n) result(myName)
      integer, intent(in) :: n
      character(len=n) :: myName
    end function iName
  end interface

  type, extends(parent) :: child
    procedure, nopass :: name
  end type child


  function name(n) result(myName)
    integer, intent(in) :: n
    character(len=n) :: myName
    myName = ' '
  end function name

end module

When I try to compile this with pgf90 version 14.3, I get the following error:

PGF90-S-0155-Result is not compatible with parent's result for type bound procedure name (pgi_override_char_param.f90: 28)
PGF90/x86-64 Linux 14.3-0: compilation completed with severe errors

This code successfully compiles using Intel Fortran as well as gfortran 4.8.2.

Hi Paul,

Thanks for the report. I’ve reproduce the error here and sent it on to engineering for further investigation (TPR#19996)

Best Regards,

This problem has been fixed in the current 14.4 release.