1! { dg-do run }
2!
3! PR 40940: CLASS statement
4!
5! Contributed by Janus Weil <janus@gcc.gnu.org>
6
7implicit none
8
9type t
10  integer :: comp
11  class(t),pointer :: c2
12end type
13
14class(t),pointer :: c1
15
16allocate(c1)
17
18c1%comp = 5
19c1%c2 => c1
20
21print *,c1%comp
22
23call sub(c1)
24
25if (c1%comp/=5) call abort()
26
27deallocate(c1)
28
29contains
30
31  subroutine sub (c3)
32    class(t) :: c3
33    print *,c3%comp
34  end subroutine
35
36end
37
38