Wrong code or ICE with CLASS(*) dummy argument and explicit size

Hello,
the following code crashes nvfortran here:

module m
  implicit none
contains
  subroutine s(a, n)
    integer,  intent(in) :: n
    class(*), intent(in) :: a(n)

    select type(a)
    type is(integer)
       print *,'a is integer, a=', a
    class default
       print *,'a is unsupported type'
       stop 1
    end select
  end
end

program p
  use m
  implicit none
  integer :: b(2,2) = reshape([21, 22, 23, 24], [2,2])

  print *,b
  call s (b,4) ! OK
  print *
  print *,b(:,1::2)
  call s (b(:,1::2),2) ! bad type
  print *
  print *,b(1::2,:)
  call s (b(1::2,:),2) ! bad type
  print *
  print *,b(2::2,:)
  call s (b(2::2,:),2) ! bad type / ICE
end

I get:

ILM file: can't find intrinsic .dsqrt
NVFORTRAN-F-0000-Internal compiler error. Errors in ILM file       1  (pgi-class-explicit-size.f90)

The ICE goes away when the last 3 code lines are commented. In that case the program does not properly recognize that the passed argument is an integer array when the caller uses a non-unity stride:

           21           22           23           24
 a is integer, a=           21           22           23           24
 
           21           22
 a is unsupported type
    1

Intel compiles the code, but produces wrong output for some of the calls.

Thanks anlauf,

I’ve added a report for this issue, tracked as TPR #33255, and sent it to engineering for review.

-Mat