3 ! Tests dtio transfer sequence types.
5 ! Note difficulty at end with comparisons at any level of optimization.
10 CHARACTER (LEN
=20) :: name
13 INTERFACE WRITE(UNFORMATTED
)
16 INTERFACE READ(UNFORMATTED
)
22 SUBROUTINE pwuf (dtv
,unit
,iostat
,iomsg
)
23 type(person
), INTENT(IN
) :: dtv
24 INTEGER, INTENT(IN
) :: unit
25 INTEGER, INTENT(OUT
) :: iostat
26 CHARACTER (LEN
=*), INTENT(INOUT
) :: iomsg
27 WRITE (UNIT
=UNIT
) DTV
%name
, DTV
%age
30 SUBROUTINE pruf (dtv
,unit
,iostat
,iomsg
)
31 type(person
), INTENT(INOUT
) :: dtv
32 INTEGER, INTENT(IN
) :: unit
33 INTEGER, INTENT(OUT
) :: iostat
34 CHARACTER (LEN
=*), INTENT(INOUT
) :: iomsg
35 READ (UNIT
= UNIT
) dtv
%name
, dtv
%age
42 TYPE (person
) :: chairman
45 chairman
%name
="Charlie"
48 OPEN (UNIT
=71, status
= 'scratch', FORM
='UNFORMATTED')
52 chairman
%name
= "Charles"
58 ! Straight comparisons fail at any level of optimization.
60 write(line
, "(A7)") chairman
%name
61 if (trim (line
) .ne
. "Charlie") STOP 1
63 write(line
, "(I4)") chairman
%age
64 if (trim (line
) .eq
. " 62") print *, trim(line
)