This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] PR29422 and PR29428 - allocatable component wrinkles
- From: "François-Xavier Coudert" <fxcoudert at gmail dot com>
- To: "Paul Thomas" <paulthomas2 at wanadoo dot fr>
- Cc: "Richard E Maine" <Richard dot Maine at nasa dot gov>, "Brooks Moses" <bmoses at stanford dot edu>, fortran at gcc dot gnu dot org
- Date: Thu, 12 Oct 2006 09:23:27 +0200
- Subject: Re: [Patch, fortran] PR29422 and PR29428 - allocatable component wrinkles
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=dKcZFmTC6ZZYbLGP+Un9mdHcloTKMsJcQ3psnvxAs+3xdNj+58Nd6QOtxjnUQtp64hh9r4bgelSTo98SrEEOmEVrDLPIJMTu82L4MAZg1Y6EdDTycdbH6dpnYUAdCW9Nth27XQMyFIsKk2ENjXprBAMMILfM9m6g22AMv33mHR8=
- References: <20061011210355.A4C265BB9A@mailhost.lps.ens.fr> <89800C6D-DA8F-4A31-AA45-EC6361A5AD3C@nasa.gov> <452D6ABB.8060702@stanford.edu> <CBA1E21E-3837-4267-AF39-9FAA7C16B1D4@nasa.gov> <452DDB57.4020303@wanadoo.fr>
Hi Paul,
In discussing PR29391 with FX, he quoted:
"That's because of F95 13.14.53:
Case (i): For an array section or for an array expression other than a whole
array or array structure component, LBOUND(ARRAY, DIM) has the value 1.
For a
whole array or array structure component, LBOUND(ARRAY, DIM) has the value:
(a) equal to the lower bound for subscript DIM of ARRAY if dimension DIM of
ARRAY does not have extent zero or if ARRAY is an assumed-size array of rank
DIM, or
(b) 1 otherwise."
About that: I've thought again, and I think the best we can do is to
actually add the extra code in the {L,U}BOUND intrinsic. gfortran uses
0-based temporaries and incorrect bounds for many array functions
return values, but it doesn't matter at all. It's all internal code,
the only place where it shows up is when you call {L,U}BOUND, because
it gets the value directly from the descriptor.
I'm now working on a very different solution to PR29391, where LBOUND
actually checks whether its argument is "a whole array or array
structure component", whether it is "an assumed-size array of rank
DIM, or has extent zero in dimension DIM" and fetch the descriptor
bounds only in this case (and in this case, I believe that they
descriptor bound values are always "right"); in other cases, it
returns 1 (or, for UBOUND, returns the number of elements in this
dimension).
What do you think about that?
FX