[Patch, Fortran] PR33139 - fix bounds for whole-array pointer assigments

Tobias Burnus burnus@net-b.de
Fri Aug 24 18:35:00 GMT 2007


:ADDPATCH fortran:

gfortran wrongly had for

  pointer => array

the bounds (1:) instead of (lbound(array):). Only for array sections the
bound starts always at 1:

  print *,  lbound(array(:), dim=1)

prints 1.


See also:

"7.4.2.1 Data pointer assignment"

"If no bounds-remapping-list is specified, the extent of a dimension of
data-pointer-object is the extent of the corresponding dimension of
data-target. [...] the lower bound of each dimension is the result of the
intrinsic function LBOUND (13.7.60) applied to the corresponding dimension of
data-target. The upper bound of each dimension is one less than the sum of the
lower bound and the extent."


Regression tested on x86-64. Ok for the trunk?

Tobias
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pointer-bounds.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070824/0ea83aa9/attachment.ksh>


More information about the Fortran mailing list