Hi!
After testing the following piece of fortran code with the nvidia hpc kit 21.9:
module def_mat
implicit none
type, abstract :: mat
end type mat
type, extends(mat) :: mat_blk
class(mat), pointer :: vA(:,:)
end type mat_blk
type, extends(mat) :: mat_csr
real(8), contiguous, pointer :: vA(:,:,:)
end type mat_csr
contains
subroutine solver_old_to_blk(As)
class(mat_blk), intent(inout) :: As
type(mat_csr), contiguous, pointer :: A00(:,:)
integer(4) :: nb
nb = 2
allocate(A00(nb,nb))
As % vA(1:nb,1:nb) => A00
select type ( w => As % vA(1,1) )
class is ( mat_csr ) ; print*,'OK'
class default ; print*,'DOES NOT WORK'
end select
end subroutine solver_old_to_blk
••
end module def_mat
program test
••
use def_mat
implicit none
class(mat_blk), pointer :: As
allocate(As)
call solver_old_to_blk(As)
end program test
we’ve noticed that it does not produce the expected result (should print “OK”). It does work correctly with gfortran 11.2.0 and with intel compilers. Could you please look into this matter, or provide a reason as to why it doesn’t work as expected?
Thank you very much in advance!