URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gfortran.fortran-torture/] [execute/] [der_io.f90] - Rev 303
Compare with Previous | Blame | View Log
! Program to test IO of derived typesprogram derived_iocharacter(400) :: buf1, buf2, buf3type xyz_typeinteger :: xcharacter(11) :: ylogical :: zend type xyz_typetype abcdef_typeinteger :: alogical :: btype (xyz_type) :: cinteger :: dreal(4) :: echaracter(11) :: fend type abcdef_typetype (xyz_type), dimension(2) :: xyztype (abcdef_type) abcdefxyz(1)%x = 11111xyz(1)%y = "hello world"xyz(1)%z = .true.xyz(2)%x = 0xyz(2)%y = "go away"xyz(2)%z = .false.abcdef%a = 0abcdef%b = .true.abcdef%c%x = 111abcdef%c%y = "bzz booo"abcdef%c%z = .false.abcdef%d = 3abcdef%e = 4.0abcdef%f = "kawabanga"write (buf1, *), xyz(1)%x, xyz(1)%y, xyz(1)%z! Use function call to ensure it is only evaluated oncewrite (buf2, *), xyz(bar())if (buf1.ne.buf2) call abortwrite (buf1, *), abcdefwrite (buf2, *), abcdef%a, abcdef%b, abcdef%c, abcdef%d, abcdef%e, abcdef%fwrite (buf3, *), abcdef%a, abcdef%b, abcdef%c%x, abcdef%c%y, &abcdef%c%z, abcdef%d, abcdef%e, abcdef%fif (buf1.ne.buf2) call abortif (buf1.ne.buf3) call abortcall foo(xyz(1))containssubroutine foo(t)type (xyz_type) twrite (buf1, *), t%x, t%y, t%zwrite (buf2, *), tif (buf1.ne.buf2) call abortend subroutine foointeger function bar()integer, save :: i = 1bar = ii = i + 1end functionend
