This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/29216] New: Derived type components of function results are not initialised


The derived type components of function results are not initialised according
to their initialisation statements. This follows from the following code:

program test
implicit none

  type A
    integer, pointer:: p => null()
    integer:: i=3
  end type A

  type(A):: x,y

  print *,associated(x%p), x%i
  x=f()
  print *,associated(x%p), x%i

contains

function f()
type(A):: f

  print *, associated(f%p), f%i

end function f

end program

and run-time output:

 F           3
 T -1073745616
 T -1073745616


-- 
           Summary: Derived type components of function results are not
                    initialised
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stephan dot kramer at imperial dot ac dot uk


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]