PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / select_type_3.f03
blobba9a88818bf38aae8217cd4e5538afeb71037626
1 ! { dg-do run }
3 ! SELECT TYPE with temporaries
5 ! Contributed by Janus Weil <janus@gcc.gnu.org>
7   type :: t1
8     integer :: i = -1
9   end type t1
11   type, extends(t1) :: t2
12     integer :: j = -1
13   end type t2
15   class(t1), pointer :: cp
16   type(t2), target :: b
18   cp => b
20   select type (cp)
21   type is (t1)
22     cp%i = 1
23   type is (t2)
24     cp%j = 2
25   end select
27   print *,b%i,b%j
28   if (b%i /= -1) STOP 1
29   if (b%j /= 2) STOP 2
31   select type (cp)
32   type is (t1)
33     cp%i = 4
34   type is (t2)
35     cp%i = 3*cp%j
36   end select
38   print *,b%i,b%j
39   if (b%i /= 6) STOP 3
40   if (b%j /= 2) STOP 4
42 end