PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / select_type_2.f03
blob41f7f080eaa8f167c4f2cc9740b43bd2d4b7f43c
1 ! { dg-do run }
3 ! executing simple SELECT TYPE statements
5 ! Contributed by Janus Weil <janus@gcc.gnu.org>
7   type :: t1
8     integer :: i
9   end type t1
11   type, extends(t1) :: t2
12     integer :: j
13   end type t2
15   type, extends(t1) :: t3
16     real :: r
17   end type
19   class(t1), pointer :: cp
20   type(t1), target :: a
21   type(t2), target :: b
22   type(t3), target :: c
23   integer :: i
25   cp => a
26   i = 0
28   select type (cp)
29   type is (t1)
30     i = 1
31   type is (t2)
32     i = 2
33   class is (t1)
34     i = 3
35   end select
37   if (i /= 1) STOP 1
39   cp => b
40   i = 0
42   select type (cp)
43   type is (t1)
44     i = 1
45   type is (t2)
46     i = 2
47   class is (t2)
48     i = 3
49   end select
51   if (i /= 2) STOP 2
53   cp => c
54   i = 0
56   select type (cp)
57   type is (t1)
58     i = 1
59   type is (t2)
60     i = 2
61   class default
62     i = 3
63   end select
65   if (i /= 3) STOP 3
67 end