ICE on assignment of minval to derived type components

Upon compilation of the standard conforming Fortran code below, nvfortran (21.3) crashes with internal compiler error:

> nvfortran -c -Mallocatable=03 ~/dftb_devel/dftbplus/bug4.f90 
NVFORTRAN-S-0000-Internal compiler error. check_member: member arrived with wrong derived type     628  (/home/aradi/dftb_devel/dftbplus/bug4.f90: 28)
  0 inform,   0 warnings,   1 severes, 0 fatal for tprogramvariables_init
! nvfortran -O2 -g -Mallocatable=03 -c bug4.f90
module testmod
  implicit none

  public :: TProgramVariables, TProgramVariables_init

  type TOption
    real :: origin(3)
  end type TOption

  type TProgramVariables
    type(TOption) :: opt
    real, allocatable :: coords(:,:)
  end type TProgramVariables


  subroutine TProgramVariables_init(this)
    type(TProgramVariables), intent(out) :: this

    this%opt%origin = minval(this%coords, dim=2)

  end subroutine TProgramVariables_init

end module testmod

Note, that chaning the assigment to

    this%opt%origin(:) = minval(this%coords, dim=2)

works around the ICE, but the assignment should also be processed without the (:) on the left hand side.

Thanks BalintAradi,

I’ve added problem report TPR #29970 and sent it to engineering for further investigation.