PR fortran/18899: ubound() failing for assumed-shape arrays

Paul Brook paul@codesourcery.com
Mon Sep 12 15:08:00 GMT 2005


> > + contains
> > +   subroutine test (b)
> > +     integer, dimension (11:, -8:), target :: b
> > +
> > +     if (lbound (b, 1) .ne. 11) call abort
> > +     if (ubound (b, 1) .ne. 50) call abort
> > +     if (lbound (b, 2) .ne. -8) call abort
> > +     if (ubound (b, 2) .ne. 71) call abort
> > +
> > +     if (lbound (b (:, :), 1) .ne. 1) call abort
> > +     if (ubound (b (:, :), 1) .ne. 40) call abort
> > +     if (lbound (b (:, :), 2) .ne. 1) call abort
> > +     if (ubound (b (:, :), 2) .ne. 80) call abort
> > +
> > +     if (lbound (b (20:30:3, 40), 1) .ne. 1) call abort
> > +     if (ubound (b (20:30:3, 40), 1) .ne. 4) call abort
> > +   end subroutine test
> > + end program main
>
> This entire test case optimizes away to nothing for me with Richard
> Guenther's array aliasing patch.  You should probably add an explicit
> interface for test and not make test CONTAINED.

I plan on fixing intermodule inlining sometime, so rearranging the testcase is 
just delaying the inevitable.

Paul



More information about the Fortran mailing list