1 ! Program to test IO of derived types
3 character(400) :: buf1
, buf2
, buf3
20 type (xyz_type
), dimension(2) :: xyz
21 type (abcdef_type
) abcdef
24 xyz(1)%y
= "hello world"
33 abcdef
%c
%y
= "bzz booo"
37 abcdef
%f
= "kawabanga"
39 write (buf1
, *), xyz(1)%x
, xyz(1)%y
, xyz(1)%z
40 ! Use function call to ensure it is only evaluated once
41 write (buf2
, *), xyz(bar())
42 if (buf1
.ne
.buf2
) call abort
44 write (buf1
, *), abcdef
45 write (buf2
, *), abcdef
%a
, abcdef
%b
, abcdef
%c
, abcdef
%d
, abcdef
%e
, abcdef
%f
46 write (buf3
, *), abcdef
%a
, abcdef
%b
, abcdef
%c
%x
, abcdef
%c
%y
, &
47 abcdef
%c
%z
, abcdef
%d
, abcdef
%e
, abcdef
%f
48 if (buf1
.ne
.buf2
) call abort
49 if (buf1
.ne
.buf3
) call abort
57 write (buf1
, *), t
%x
, t
%y
, t
%z
59 if (buf1
.ne
.buf2
) call abort
62 integer function bar()
63 integer, save :: i
= 1