[Bug fortran/45489] New: Default initialization of derived-type function result missing

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Sep 1 21:01:00 GMT 2010


The following program fails because the function result in "f" is never
initialized. It should be default initialized, which works using other
compilers.

  type A
    integer, pointer:: p => null ()
    integer:: i=3
  end type A
  type(A):: x
  x=f()
  if (associated(x%p) .or. x%i /= 3) call abort ()
contains
  function f() result (fr)
    type(A):: fr
  end function f
end


-- 
           Summary: Default initialization of derived-type function result
                    missing
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
OtherBugsDependingO 32834
             nThis:


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



More information about the Gcc-bugs mailing list