http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59104

            Bug ID: 59104
           Summary: Wrong result with SIZE specification expression
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org

James Van Buskirk found the following problem,
https://groups.google.com/forum/#!topic/comp.lang.fortran/2RleGXz6-ew

Result with GCC 4.8 + 4.9:
   size(f) =            1
   size(y) =   2143476561

Result with GCC 4.5, 4.6 and 4.7:
 size(f) =            1
 size(y) =            1

Expected result:
 size(f) =            1
 size(y) =            2


module m1
   implicit none
   integer, parameter :: dp = kind([double precision::])
   contains
      recursive function f(x)
         integer, intent(in) :: x
         real(dp) f(x/2)
         integer y(size(f)+1)

         write(*,*) 'size(f) = ',size(f)
         write(*,*) 'size(y) = ',size(y)
         f = 0
      end function f
end module m1

program bug3
   use m1
   implicit none
   real y

   y = sum(f(2))
end program bug3

Reply via email to