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
6module m1
7  type t1
8     integer i
9  end type t1
10end module m1
11
12module 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
25contains
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
39end module m2
40
41use m2
42call test
43end
44