[J3] Should ALLOCATED return True or False if ARRAY is zero-sized?
Steve Lionel
steve at stevelionel.com
Fri Jul 11 16:44:53 UTC 2025
I recall this issue arising in Intel Fortran (or maybe even DEC Fortrran) -
ALLOCATED should return true even if the object is zero-sized.
Steve
On Fri, Jul 11, 2025 at 11:50 AM Daniel Chen via J3 <
j3 at mailman.j3-fortran.org> wrote:
> Hello all,
>
> ```
> real, allocatable :: r1(:)
> allocate(r1(0))
> print*, allocated(r1)
> end
> ```
>
> The standard seems allowing allocating a zero-sized array ([9.7.1.2
> Execution of an ALLOCATE statement]. Therefore, intrinsic ALLOCATED
> should return True for this code.
> Is this conclusion correct?
>
> Thanks,
> Daniel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20250711/ec912a1c/attachment.htm>
More information about the J3
mailing list