2009-10-05 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / der_io_3.f90
blob1cb370ce17c73bfc887db2dc015f6a72e6602400
1 ! { dg-do compile }
2 ! { dg-options "-std=legacy" }
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
12 module m2
13 use m1
15 type t2
16 private
17 type (t1) t
18 end type t2
20 type t3
21 private
22 integer i
23 end type t3
25 contains
26 subroutine test
27 character*20 c
28 type(t2) :: a
29 type(t3) :: b
31 a % t % i = 31337
32 b % i = 255
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
41 use m2
42 call test
43 end
45 ! { dg-final { cleanup-modules "m1 m2" } }