ICE: Lowering Error: allocate with no array size

Hi, I’ve just faced this issue that is not critical, but kind of interesting to me because the SUM intrinsic is involved (if I replace the SUM intrinsic or if I uncomment the subroutine, it builds fine).

So, the following program hangs the compiler:

program bug_contains
implicit none

integer :: y

integer, parameter  ::  dx = 32
integer, parameter  ::  dy = 32

integer :: A(dx)
integer :: B(dx,dy)

B = 0.

A(:) = SUM(B(:,:), dim=2)

!this line causes the issue, when building with -fast, -O2 or -O3
contains

!uncommenting this subroutine eliminates the issue
!subroutine dummy(B)
!  integer :: B
!  B=0
!end subroutine

end program

The compiler shows the message below before hanging:

Lowering Error: allocate with no array size [ast=76,asttype=38,datatype=0]

Tested with nvfortran 24.3.

Thank Rommel. Definitely an interesting corner case in that it seems to only occur with 2D fixed sized arrays in a SUM intrinsic when dim=2, and there’s an empty contains statement.

I added a report, TPR#35797 and sent it to engineering.

1 Like