Fortran polymorphic array issue with bounds with version 21.2

The following code shows different upper and lower bounds when passing a slice of an array to a subroutine with polymorphic type for that argument. The modified bounds are only present inside the select type construct

  program select_type_bug
  
      implicit none
  
      integer :: values(2)
  
      values = 10
  
      call foo(values)
      call foo(values(:1))
      call foo(values(:2))
  
      contains
  
      subroutine foo(attr)
  
        class(*), intent(in) :: attr(:)
  
        write(*,*) 'outside', SIZE(attr), LBOUND(attr),UBOUND(attr)
  
        select type(attr)
          type is (integer)
                  write(*,*) 'inside ', SIZE(attr), LBOUND(attr),UBOUND(attr)
        end select
      end subroutine
  
  end program

Produces the output

  outside            2            1            2
   inside             2            1            2
   outside            1            1            1
   inside             1            0            0
   outside            2            1            2
   inside             2            0            1

Best,
Henning Janßen

Thanks Henning. This is a known issue but unfortunately not yet fixed. Though, I have added a new problem report, TPR #31279, to track your report.

-Mat