Nvfortran25 fails with polymorphic pointer , Illegal POINTER assignment

I am compiling a fortran code with nvfortran.

The compiler version I am using is:

nvfortran 25.1-0 64-bit target on x86-64 Linux -tp cascadelake

I use iso_c_binding with a polymorphic pointer: The code compiles and run in gfortran and intel fortran, but fails with type mismatch error in nvfortran.

Here is a sample code which reproduces the error:

program sample
use iso_c_binding
type mytype
class(*), pointer :: anyptr => null()
endtype mytype

type(mytype) :: myobj
type(c_funptr), pointer  :: ptrval
!integer, pointer :: ptrval
!real, pointer :: ptrval
ptrval => myobj%anyptr

endprogram sample

nvfortran sample.f90 gives me the error:

NVFORTRAN-S-0155-Illegal POINTER assignment - type mismatch (sample.f90: 11)
0 inform, 0 warnings, 1 severes, 0 fatal for sample

Pointer of any other type also gives the same error. I tried the commented lines, integer and real pointer types, as well.

Hi rajany.kv,

Thanks for the report and great reproducing example. I’ve confirmed that it’s a compiler issue so filed a report, TPR #37205, and sent it engineering for investigation.

-Mat