Hello,
I found an issue where operations on a derived type array in combination with an empty contains region lead to a Lowering Error.
A minimal example which triggers this is here:
program p1
implicit none
type foo
integer :: i
end type foo
type(foo) :: bar(5)
bar(:)%i = 1
print *, 'bar:', bar%i
contains
end program p1
Compiling with nvfortran (24.7) gives the error message:
Lowering Error: allocate with no array size [ast=57,asttype=38,datatype=0]
I found two solutions to remedy the issue:
- Make bar(:) an allocatable
type(foo), allocatable :: bar(:)
allocate(bar(5))
- Just remove the contains statement
Similar issues occur where the contains statement is part of a subroutine.
This issue has an easy fix, but I assume the root of the problem lies deeper than the contains statement.