OSDN Git Service

gcc/fortran:
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / der_array_io_2.f90
1 ! Test IO of arrays in derived type arrays
2 ! { dg-do run }
3 program main
4
5   character *1000 buf1, buf2
6
7   type :: foo_type                                             
8      integer x(3)
9      integer y(4)
10      integer z(5)
11      character*11 a(3)
12   end type foo_type
13                                                                         
14   type (foo_type) :: foo(2)
15   
16   foo(1)%x = 3
17   foo(1)%y = 4
18   foo(1)%z = 5
19   foo(1)%a = "hello world"
20
21   foo(2)%x = 30
22   foo(2)%y = 40
23   foo(2)%z = 50
24   foo(2)%a = "HELLO WORLD"
25
26   write (buf1,*)  foo
27   write (buf2,*) ((foo(i)%x(j),j=1,3), (foo(i)%y(j),j=1,4), (foo(i)%z(j),j=1,5), (foo(i)%a(j),j=1,3), i=1,2)
28   if (buf1.ne.buf2) call abort
29 end program main