1! { dg-do run }
2!
3! PR 57306: [OOP] ICE on valid with class pointer initialization
4!
5! Contributed by Andrew Benson <abensonca@gmail.com>
6
7module m
8  type :: c
9  end type c
10  type, extends(c) :: d
11  end type d
12  type(c), target :: x
13  type(d), target :: y
14end module m
15
16 use m
17  class(c), pointer :: px => x
18  class(c), pointer :: py => y
19
20  if (.not. associated(px, x))   STOP 1
21  if (.not. same_type_as(px, x)) STOP 2
22  if (.not. associated(py, y))   STOP 3
23  if (.not. same_type_as(py, y)) STOP 4
24end
25