[Patch, Fortran] PR 43228 - fix reading of arrays with strides in NAMELISTs
Jerry DeLisle
jvdelisle@verizon.net
Thu Mar 11 14:41:00 GMT 2010
On 03/11/2010 06:20 AM, Tobias Burnus wrote:
> Hi all,
>
> gfortran supports as extension that using
>
> &nml a(1,1) = 1, 2, 3, 4 /
>
> reads the values to a(1,1) and the next contiguously following array
> elements. Additionally, it support according to the standard:
>
> &nml a(:,:) = 1,2,3,4,5,6 /
> &nml a(:,1) = 1,2,3 /
>
> However, for a(1,:) gfortran was effectively using
> a(1:ubound(a,dim=1),:), leading to wrong results. The problem was that
> when encountering "a(1" everything was prepared for "a(1,n)" extended
> reading and moving back to array section reading for "a(1,:)" did not
> happen. For "a(:" that mode was set right away and thus "a(:,1)" was
> handled correctly.
>
> The attached patch now recovers the non-extended read as soon as ":" is
> read. As the previous dimensions have to be an element (otherwise a ":"
> would have been encountered before), setting "end = start" recovers the
> required bonds. (The end-bound setting is needed as otherwise the bonds
> are end == ubound.)
>
> Build and regtested on x86-64-linux. OK for the trunk? Shall this be
> also backported to the 4.4 branch?
>
> Tobias
Looks Good, OK to commit. Thanks.
Jerry
More information about the Fortran
mailing list