Polymorphic pointers does not work with bind(c) derived type in nvfortran

Polymorphic pointers does not work with bind(c) derived type in nvfortran 25.5

A similar issue was raised and was fixed in the 25.5 release. It works now for c_ptr and c_funptr types, but still not for bind(c) derived types.

Example code that fails:

program test
use iso_c_binding
class(*), pointer :: scalar => null()
type, bind(c) :: myctype
integer(c_long) :: val
endtype myctype

type(myctype), pointer :: myobj
type(myctype), target :: mytar

scalar => mytar

selecttype(tmp=> scalar)

class default
if(associated(scalar)) then
myobj => tmp
print *, “success”
else
myobj => null()
print *, “null success”
endif
endselect

NVFORTRAN-S-0155-Illegal POINTER assignment - type mismatch (nvtest.f90: 25)
0 inform, 0 warnings, 1 severes, 0 fatal for test
It works in gfortran.

Hi rajany.kv,

This is another unsupported feature in the current nvfortran that will be supported in our upcoming LLVM based nvfortran compiler.

-Mat