This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran] PR 38324 Wrong array bounds for array implicit sections of derived components


Mikael,

Your patch looks good to me.  It is indeed extraordinary that this was
never noticed.  However, I guess that for many the difference between
for UBOUND between a full array and a full section is so arcane as not
to be noticable:-)

The ik = 8 failure reported by Dominique is a bit strange.  I suppose
that these involve a (conversion) function rather than a variable?

What to do with this, I do not know - we maybe are running too close
to the end of stage three to risk it.  Probably, in the cold light of
day, the decision to commit my patch was a bit hasty.....

Cheers

Paul

On Wed, Jan 28, 2009 at 11:10 PM, Mikael Morin <mikael.morin@tele2.fr> wrote:
> Hi all,
>
> I'm following the latest trend in gfortran development, namely fixing
> ubound (and lbound).
>
> The problem appears in code like this...:
> x=struct(ia)
> print *, 'bounds, full array           ', lbound(x%ib), ubound(x%ib)
> x=struct(ia(:))
> print *, 'bounds, full implicit section', lbound(x%ib), ubound(x%ib)
> x=struct(ia(from:to))
> print *, 'bounds, full explicit section', lbound(x%ib), ubound(x%ib)
>
> ... returning this:
>  bounds, full array                     -1           2
>  bounds, full implicit section          -1           2    <-- should not
> it be 1 4 as above?
>  bounds, full explicit section           1           4
>
> (The comment is from Dominique ;-) )
>
> The bug lies in gfc_conv_expr_descriptor which is passing array
> descriptor as-is in case of a full array section. This is wrong if the
> bounds are not 1-based.
>
> This has been there since revision 119990 and probably before, and I
> find it strange it was not discovered before.
>
> Now, to trunk or not to trunk, that is the question.
>
> The patch is obvious.
> It is impacting a very sensitive function (gfc_conv_expr_descriptor).
> It is changing a harmless part of it (deciding whether to keep the
> descriptor).
> It is regtested on x86_64-unknown-linux-gnu.
>
> Ok for 4.4?
> One can wait a bit to decide, so that there is nothing left to decide ;).
>
> Mikael
>
> 2009-01-28  Mikael Morin  <mikael.morin@tele2.fr>
>
>        PR fortran/38324
>        * gfortran.dg/derived_bounds_1.f90: New test.
>
> 2009-01-28  Mikael Morin  <mikael.morin@tele2.fr>
>
>        PR fortran/38324
>        * trans-array.c (gfc_conv_expr_descriptor): Disable passing
>        descriptor as-is in the full array section case.
>



-- 
The knack of flying is learning how to throw yourself at the ground and miss.
       --Hitchhikers Guide to the Galaxy


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]