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

            Bug ID: 67125
           Summary: Incorrect bounds with source allocation,
                    source=<function>
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mrestelli at gmail dot com
  Target Milestone: ---

The following code prints 0 2 while I think the correct result should
be 1 3 (using gfortran 6.0.0):


program p
 implicit none
 integer, allocatable :: a(:)

 allocate( a , source=f(3) )
 write(*,*) lbound(a,1), ubound(a,1) ! prints 0 2 instead of 1 3

contains

 pure function f(i)
  integer, intent(in) :: i
  integer :: f(i)
   f = 2*i
 end function f
end program p

Reply via email to