Problem with deferred-length character component

Hi

The following code does not compile with pgf90 21.7 :

MODULE BATOR_DECODNETCDF_MOD

IMPLICIT NONE

TYPE var 
  character(len=:),          dimension(:),     pointer :: Char1d   => NULL()
 END TYPE var 

interface
function nf90_get_var(ncid, varid, values, start, count, stride, map)
integer, intent( in) :: ncid, varid
character (len = *), dimension(:), intent(out) :: values
integer, dimension(:), optional, intent( in) :: start, count, stride, map 
integer :: nf90_get_var
end function
end interface



CONTAINS

subroutine GetVariable(ncid,Tvar)

  integer(kind=4), intent(in)        :: ncid
  TYPE(var), intent(inout)           :: Tvar
  integer(kind=4)                    :: iret
  integer, dimension(1)              :: Length
  integer(kind=4)                    :: VarId   = -1
  character(len=:),  dimension(:), pointer :: Char1d   => NULL()

  iret = nf90_get_var(ncid,VarId,TVar%Char1d(:),count=(/length(1)/))

end subroutine GetVariable


END MODULE BATOR_DECODNETCDF_MOD
$ pgf90 -c  bator_decodnetcdf_mod.F90
NVFORTRAN-F-0000-Internal compiler error. gen_sptr(): unexpected storage type       0  (bator_decodnetcdf_mod.F90: 33)
NVFORTRAN/x86-64 Linux 21.7-0: compilation aborted

Works fine with ifort (>=18.0.5) and gfortran (>= 9.2).

Regards,

Philippe

Hi Philippe,
We’ve had a few reports of issues with deferred-length character fields within derived types. I added this report, which is TPR 30577.

  • Brent

Thank you Brent