PSyclone
PSyclone copied to clipboard
psyir support for arrays declared with indexed bounds
We need to add support for arrays declared like a(0:n-1). At the moment they are stored as unknown fortran type, however this caused psyad to fail in poly2d_w3_reconstruction_kernel_mod.F90
This is also an issue in WW3 code - it prevents the application of HoistLocalArrayTrans
to quite a number of arrays.
It is also an issue in NEMO 4.2 now that the tiling complicates the array declarations.
Simon has reported that when PSyclone processes, e.g.:
subroutine my_sub(arg)
implicit none
real, dimension(2:) :: arg
arg(:) = 0.0
end subroutine my_sub
then it loses the lower bound of the array declaration and generates incorrect code:
subroutine my_sub(arg)
real, dimension(:) :: arg
arg(:) = 0.0
end subroutine my_sub
So far it seems that the forms of declaration that this issue was originally opened for are already supported. However, a(4:)
ends up with an ArrayType with shape = [Extent.Attribute]
which explains why we lose the lower bound.
I think we want shape = [ArrayBounds(Literal(4), Extent.Attribute)]