This is the mail archive of the gcc-patches@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]

Re: [Patch, fortran] PR34438 - gfortran not compliant w.r.t default initialization of derived type component and implicit SAVE attribute


> Why would somebody write something as awful as

Not me!-) but some people collects butterflies and I collect
junk fortran codelets.

More seriously I did not try to reduce the test to something
simpler (and less ugly), but the problem seems related to
ENTRY. The following variant:

MODULE M1
 TYPE T1
  INTEGER :: i=7
 END TYPE T1
CONTAINS
 FUNCTION F1(d1) RESULT(res)
  INTEGER :: res
  TYPE(T1), INTENT(OUT) :: d1
  res=d1%i
  d1%i=0
 END FUNCTION F1
 FUNCTION E1(d1) RESULT(res)
  INTEGER :: res
  TYPE(T1), INTENT(INOUT) :: d1
  res=d1%i
  d1%i=0
 END FUNCTION E1
END MODULE M1
USE M1
TYPE(T1) :: D1
D1=T1(3)
write(6,*) F1(D1)
D1=T1(3)
write(6,*) E1(D1)
END

gives

           7
           3

Dominique


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