[J3] ALLOCATE with source-expr determining the array bound & resulting lower bound

Bader, Reinhold Reinhold.Bader at lrz.de
Wed Dec 1 07:57:43 UTC 2021


> -----Ursprüngliche Nachricht-----
> Von: J3 <j3-bounces at mailman.j3-fortran.org> Im Auftrag von Tobias Burnus
> via J3
> Gesendet: Mittwoch, 1. Dezember 2021 08:38
> An: Van Snyder <van.snyder at sbcglobal.net>; General J3 interest list
> <j3 at mailman.j3-fortran.org>
> Cc: Tobias Burnus <burnus at net-b.de>; Harald Anlauf <anlauf at gmx.de>;
> Chung-Lin Tang <cltang at codesourcery.com>
> Betreff: Re: [J3] ALLOCATE with source-expr determining the array bound &
> resulting lower bound
> 
> On 01.12.21 00:09, Van Snyder wrote:
> >>   allocate(c, source=h(3))
> 
> I want to come back to my original question. I think we do agree what
> lbound(h(3),1) gives (namely: 1) and, personally, I do not see an issue with
> lbound.
> 
> However, for allocate with source-expr I still wonder about the bounds.
> 
> And I still think it would be useful to explicitly state that the lower bounds
> comes from applying LBOUND to the source-expr. (Matching what is done at
> several other places in the standard: intrinsic assignments to allocatables,
> pointer association, 'associate', 'select rank'.)

These semantics apply for all array expressions, so an explicit statement would need to be added
to 10.1.1. Given that we've lived with this for decades I'm not sure such an addition is necessary.

> 
> 
> > The result value of h(3) is allocatable and therefore its bound(s) are
> > the ones specified when it was allocated (15.3.3, 15.5.3).
> 
> I note that Malcolm wrote elsewhere in this thread: “Only variables and
> components can have the ALLOCATABLE attribute. The result of referencing
> a function whose result variable has the ALLOCATABLE attribute is a value
> that does not itself have the ALLOCATABLE attribute”
> 
> Tobias



More information about the J3 mailing list