OSDN Git Service

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