program test
implicit none

 type A
   integer, allocatable :: j(:)
 end type A

 type(A):: x
 x=f()

contains

 function f()
   type(A):: f
     print *,"I'm only called once in the fortran!"
     f = A((/1,2/))
 end function f

end program

calls the function twice!

The code produced shows that the assignment nullifies the data field of the
function, which results in it's being called a second time.


Paul


-- 
           Summary: Error in allocatable component function calls
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: pault at gcc dot gnu dot org
        ReportedBy: pault at gcc dot gnu dot org


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

Reply via email to