NVFORTRAN-F-0000-Internal compiler error. mk_subscr: bad numdim 0

Is this violating Fortran standards, or is there an actual bug?

function test(inarr) result(outarr)
    integer :: inarr(:)
    integer :: j
    integer :: outarr(product((/(j,j=1,size(inarr))/)))
end function test
NVFORTRAN-F-0000-Internal compiler error. mk_subscr: bad numdim       0  (bug.f90: 4)
NVFORTRAN/x86-64 Linux 22.7-0: compilation aborted

Thank you!

Hi Tobias,

It look legal to me, so I added an issue report (TPR #32267) and sent it to engineering for investigation.

Even if it were illegal, the compiler should be giving an user error, not an ICE.

Thanks for the report!
Mat

Hi Tobias,

Engineering has provided a work-around:

function test(inarr) result(outarr)
    integer :: inarr(:)
    integer :: j
    integer,allocatable :: outarr(:)
    allocate(outarr(product((/(j,j=1,size(inarr))/))))
    outarr = 0
end function test

-Mat