gcc/testsuite/gfortran.dg/der_array_io_2.f90
raw| 1 | ! Test IO of arrays in derived type arrays |
| 2 | ! { dg-do run } |
| 3 | ! { dg-options "-std=legacy" } |
| 4 | ! |
| 5 | program main |
| 6 | |
| 7 | character *1000 buf1, buf2 |
| 8 | |
| 9 | type :: foo_type |
| 10 | integer x(3) |
| 11 | integer y(4) |
| 12 | integer z(5) |
| 13 | character*11 a(3) |
| 14 | end type foo_type |
| 15 | |
| 16 | type (foo_type) :: foo(2) |
| 17 | |
| 18 | foo(1)%x = 3 |
| 19 | foo(1)%y = 4 |
| 20 | foo(1)%z = 5 |
| 21 | foo(1)%a = "hello world" |
| 22 | |
| 23 | foo(2)%x = 30 |
| 24 | foo(2)%y = 40 |
| 25 | foo(2)%z = 50 |
| 26 | foo(2)%a = "HELLO WORLD" |
| 27 | |
| 28 | write (buf1,*) foo |
| 29 | 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) |
| 30 | if (buf1.ne.buf2) STOP 1 |
| 31 | end program main |