This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, fortran] PR34438 - gfortran not compliant w.r.t default initialization of derived type component and implicit SAVE attribute
To add to the confusion, the following code
MODULE M1
TYPE T1
INTEGER :: i=7
INTEGER :: j=5
END TYPE T1
CONTAINS
FUNCTION F1(d1) RESULT(res)
INTEGER :: res
TYPE(T1), INTENT(OUT) :: d1
! TYPE(T1), INTENT(OUT) :: d2
res=d1%i
d1%i=0
RETURN
ENTRY E1(d1) RESULT(res)
res=d1%j
d1%j=0
! ENTRY E1(d2) RESULT(res)
! res=d2%j
! d2%j=0
END FUNCTION F1
END MODULE M1
USE M1
TYPE(T1) :: D1
D1=T1(3,6)
write(6,*) F1(D1)
D1=T1(3,6)
write(6,*) E1(D1)
END
gives
7
5
while if I remove the comments and comment the ENTRY part with d1
I get:
Bus error
Dominique