[Patch, Fortran] PR67125 - ALLOCATE with source-expr lbounds/ubound off by one

Tobias Burnus tobias.burnus@physik.fu-berlin.de
Fri Oct 12 11:29:00 GMT 2018


Hello all,

"When an ALLOCATE statement is executed for an array with no
 allocate-shape-spec-list, the bounds of source-expr determine
 the bounds of the array." (F2018, 9.7.1.2 (6))

That seems to work fine for arrays which have an array descriptor.
However, as the current code shows, it fails for array constructors
where the lbound is zero instead of the expected one.

It turns out (PR67125) that functions results which don't use array
descriptors have the same problem as do stack/static allocated
array variables (PR87580).

I am not sure that my check for array descriptors is the best but
it seems to work and fixes the problem.

OK for the trunk?
Build and regtested on x86-64-linux.

Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr67125.diff
Type: text/x-diff
Size: 6624 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20181012/e64da5a6/attachment.bin>


More information about the Fortran mailing list