Possible bug in gfortran: array sections in actual arguments

Paul Richard Thomas paul.richard.thomas@gmail.com
Wed Jan 28 17:15:00 GMT 2009


Clive,

On Wed, Jan 28, 2009 at 4:46 PM, Clive Page <clivegpage@googlemail.com> wrote:
> I think I may have found a bug in the way that gfortran handles array
> sections.  I had an image that I wanted to invert in the y-axis, so handed
> it over to a subroutine as an array section, e.g.
>  array(:, ny:-:-1)
> This didn't work, as shown below.
>
> Here's a simple test program, which I think is valid Fortran.  By the way,
> using the triplet notation correctly inverts the array if used in an
> assignment statement, it is just the use in a procedure call which seems not
> to work properly.

This is due to a bug in ubound.  Change the upper limit of the DO to 3
and you will see your programme work beautifully.

Not only this, your bug is one and the same as PR38852, for which I
had already posted a patch on Bugzilla but not yet on this list.
Happily, the patch fixes your bug too:-)  I am very pleased to find
another case where this bug shows up and will incorporate your
testcase in that of the gfortran testsuite.

I am of the opinion that this is a P1 for fortran and should be fixed
now - does anybody else feel the same way?  Whilst I thought that it
only affected pointers I was happy to leave it to 4.5.  However, the
use of array dummy arguments is quite another matter.

Cheers

Paul



More information about the Fortran mailing list