https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67894

            Bug ID: 67894
           Summary: bounds of assumed-rank dummy argument not equal to
                    actual argument
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: john.donners at surfsara dot nl
  Target Milestone: ---

the draft Fortran 2015 standard reads:

An actual argument of any rank may correspond to an assumed-rank dummy
argument. The rank and shape of the dummy argument are the rank and shape of 
the corresponding actual argument. If the rank is nonzero, the lower and upper 
bounds of the dummy argument are those that would be given by the intrinsic 
functions LBOUND and UBOUND respectively if applied to the actual argument, 
except that when the actual argument is assumed-size, the upper bound of the 
last dimension of the dummy argument is 2 less than the lower bound of
that dimension.

(section 12.5.2.4, paragraph 15)

Here is a small test program:

program assumedrank
 implicit none
 real,dimension(:,:,:),allocatable :: bb
 real,dimension(3:9,10:15,16:32) :: c

 allocate(bb(3:9,10:15,16:32))
 print*, 'Actual argument, allocatable, lbound=',lbound(bb)
 call p(bb)
 print*, 'Actual argument, lbound=',lbound(c)
 call p(c)

 contains

 subroutine p(a)
  real,dimension(..) :: a
  print*,'Dummy argument, lbound=',lbound(a)

 end subroutine p

end

gfortran 5.2.0 returns 1 1 1 as the lower bounds, both for the allocatable and
the fixed-shape array.

Reply via email to