[J3] Is it standard conforming to index a zero-sized array?

Daniel C Chen cdchen at ca.ibm.com
Tue Sep 21 17:32:20 UTC 2021


Is the following code legal?

integer, allocatable :: arr(:)
allocate(arr(0))
arr(5) = 1          !! Is this line legal?
end

I understand a zero-sized array is always defined and it can be used as LHS
of an assignment. But is it legal to indexing it?
I seems can't find any specific rule about it in the standard.

Thanks,

Daniel Chen

XL Fortran Development, Fortran Standard Representative
IBM Toronto Software Lab
Phone: 905-413-3056
Tie: 969-3056
Email: cdchen at ca.ibm.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20210921/165c80f4/attachment.htm>


More information about the J3 mailing list