ICE Lowering Error with Derived Type

I’m curious if the following works with the latest version:

% cat lowerror.f90
module low_mod
  implicit none
  private
  public :: vd
  public :: assignment(=)
  public :: operator(-), operator(/)

  integer, parameter :: NMax = 19, r8 = selected_real_kind(15,100)

  type vd
     real(r8) :: value
     real(r8) :: deriv(NMax)
     integer  :: ind(NMax)
     integer  :: nderiv = -1
  end type vd

  interface assignment(=)
     module procedure nv1, nvi
  end interface
  interface operator(-)
     module procedure vmv
  end interface

contains

  pure subroutine ad(r,n,ind)
    type(vd), intent(out) :: r
    integer,  intent(in)  :: n
    integer,  intent(in)  :: ind(:)
    r%nderiv=n
    if (n > 0) then
       r%ind(1:n)=ind(1:n)
       r%deriv(1:n)=0._r8
    end if
  end subroutine ad

  elemental subroutine mv(v1,v2)
    type(vd), intent(inout) :: v1
    type(vd), intent(in)    :: v2
    type(vd) :: r
    integer :: n, i, j
    call nv2(r,v1,v2)
    n = r%nderiv
    r%deriv(1:n) = 0._r8
    r%value = v1%value - v2%value
    j = 0
    do i = 1, v1%nderiv
       do j = j+1, n
          if (v1%ind(i) == r%ind(j)) then
             r%deriv(j) = v1%deriv(i)
             exit
          end if
       end do
    end do
    j = 0
    do i = 1, v2%nderiv
       do j = j+1, n
          if(v2%ind(i) == r%ind(j)) then
             r%deriv(j) = r%deriv(j) - v2%deriv(i)
             exit
          end if
       end do
    end do
    call nv1(v1,r)
  end subroutine mv

  elemental subroutine nv1(r,v)
    type(vd), intent(out) :: r
    type(vd), intent(in)  :: v
    call ad(r,v%nderiv,v%ind)
    r%value = v%value
    r%deriv(1:r%nderiv) = v%deriv(1:v%nderiv)
  end subroutine nv1

  elemental subroutine nv2(r,v1,v2)
    type(vd), intent(out) :: r
    type(vd), intent(in)  :: v1, v2
    integer :: n, i1, i2, n1, n2
    integer, allocatable :: itab(:)
    n1 = v1%nderiv
    n2 = v2%nderiv
    allocate(itab(n1+n2))
    n = 0
    i1 = 1
    i2 = 1
    do
       if (i1 > n1) then
          itab(n+1:n+1+n2-i2) = v2%ind(i2:n2)
          n = n + 1+n2-i2
          exit
       else if (i2 > n2) then
          itab(n+1:n+1+n1-i1) = v1%ind(i1:n1)
          n = n + 1+n1-i1
          exit
       else if (v1%ind(i1) == v2%ind(i2)) then
          n = n + 1
          itab(n) = v1%ind(i1)
          i1 = i1 + 1
          i2 = i2 + 1
       else if (v1%ind(i1) < v2%ind(i2)) then
          n = n + 1
          itab(n) = v1%ind(i1)
          i1 = i1 + 1
       else
          n = n + 1
          itab(n) = v2%ind(i2)
          i2 = i2 + 1
       end if
    end do
    call ad(r,n,itab)
    deallocate(itab)
  end subroutine nv2

  elemental subroutine nvi(r,c)
    type(vd), intent(out) :: r
    integer,  intent(in)  :: c
    call ad(r,0,(/0/))
    r%value = c
  end subroutine nvi

  elemental function vmv(v1,v2) result(r)
    type(vd), intent(in) :: v1,v2
    type(vd) :: r
    call nv1(r,v1)
    call mv(r,v2)
  end function vmv
end module low_mod

program lowerror
  use low_mod
  implicit none

  call vdtest(1000)

contains

  subroutine vdtest(nx)
    integer, intent(in) :: nx

    type(vd), allocatable :: p(:), v(:)

    allocate(p(nx),v(nx-1))
    p = 0
    v = p(1:nx-1) - p(2:nx)
  end subroutine vdtest
end program lowerror

% pgf95 -o lowerror lowerror.f90
Lowering Error: array upper bound is not a symbol for datatype 54
Lowering Error: array extnt is not a symbol for datatype 54
PGF90-F-0000-Internal compiler error. Errors in Lowering       2 (lowerror.f90: 145)
PGF90/x86-64 Linux 8.0-5: compilation aborted

% pgf95 -V
pgf95 8.0-5 64-bit target on x86-64 Linux -tp core2-64
Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
Copyright 2000-2009, STMicroelectronics, Inc.  All Rights Reserved.

Hi,

This works with 9.0-1. Please try.

Hongyon