Debian Codegraph @

gcc/testsuite/gfortran.dg/pr104625.f90

raw
1 ! { dg-do compile }
2 !
3 ! Check the fix for PR104625 in which the selectors in parentheses used
4 ! to cause ICEs. The "Unclassifiable statement" errors were uncovered once
5 ! the ICEs were fixed.
6 !
7 ! Contributed by Gerhard Steinmetz <[email protected]>
8 !
9 program p
10 implicit none
11 type t
12 integer :: a
13 end type
14 contains
15 subroutine s(x)
16 ! class(t) :: x ! Was OK
17 class(t) :: x(:) ! Used to ICE in combination with below
18 class(t), allocatable :: r(:)
19
20 select type (y => x) ! OK
21 type is (t)
22 y%a = 99
23 end select
24 select type (z => (x)) ! Used to ICE
25 type is (t)
26 r = z(1) ! Used to give "Unclassifiable statement" error
27 z%a = 99 ! { dg-error "cannot be used in a variable definition" }
28 end select
29 select type (u => ((x))) ! Used to ICE
30 type is (t)
31 r = u(1) ! Used to give "Unclassifiable statement" error
32 u%a = 99 ! { dg-error "cannot be used in a variable definition" }
33 end select
34 end
35 end