OSDN Git Service

2010-07-29 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / der_io_3.f90
1 ! { dg-do compile }
2 ! { dg-options "-std=legacy" }
3 !
4 ! PR23843
5 ! Make sure derived type I/O with PRIVATE components works where it's allowed
6 module m1
7   type t1
8      integer i
9   end type t1
10 end module m1
11
12 module m2
13   use m1
14
15   type t2
16      private
17      type (t1) t
18   end type t2
19
20   type t3
21      private
22      integer i
23   end type t3
24
25 contains
26   subroutine test
27     character*20 c
28     type(t2) :: a
29     type(t3) :: b
30
31     a % t % i = 31337
32     b % i = 255
33     
34     write(c,*) a
35     if (trim(adjustl(c)) /= "31337") call abort
36     write(c,*) b
37     if (trim(adjustl(c)) /= "255") call abort
38   end subroutine test
39 end module m2
40
41 use m2
42 call test
43 end
44
45 ! { dg-final { cleanup-modules "m1 m2" } }