xref: /llvm-project/flang/test/Semantics/label05.f90 (revision a4bc44ad675a36c43eec9e08d5360f97ca97c389)
1! RUN: not %flang_fc1 -fdebug-unparse-with-symbols %s 2>&1 | FileCheck %s
2! CHECK: Label '50' was not found
3! CHECK: warning: Label '55' is in a construct that should not be used as a branch target here
4! CHECK: Label '70' is not a branch target
5! CHECK: Control flow use of '70'
6! CHECK: error: Label '80' is in a construct that prevents its use as a branch target here
7! CHECK: error: Label '90' is in a construct that prevents its use as a branch target here
8! CHECK: error: Label '91' is in a construct that prevents its use as a branch target here
9! CHECK: error: Label '92' is in a construct that prevents its use as a branch target here
10! CHECK: error: Label '30' is in a construct that prevents its use as a branch target here
11! CHECK: error: Label '31' is in a construct that prevents its use as a branch target here
12! CHECK-NOT: error: Label '32' is in a construct that prevents its use as a branch target here
13! CHECK: error: Label '40' is in a construct that prevents its use as a branch target here
14! CHECK: error: Label '41' is in a construct that prevents its use as a branch target here
15! CHECK-NOT: error: Label '42' is in a construct that prevents its use as a branch target here
16
17subroutine sub00(a,b,n,m)
18  real a(n,m)
19  real b(n,m)
20  if (n .ne. m) then
21     goto 50
22  end if
236 n = m
24end subroutine sub00
25
26subroutine sub01(a,b,n,m)
27  real a(n,m)
28  real b(n,m)
29  if (n .ne. m) then
30     goto 55
31  else
3255   continue
33  end if
3460 n = m
35end subroutine sub01
36
37subroutine sub02(a,b,n,m)
38  real a(n,m)
39  real b(n,m)
40  if (n .ne. m) then
41     goto 70
42  else
43     return
44  end if
4570 FORMAT (1x,i6)
46end subroutine sub02
47
48subroutine sub03(a,n)
49  real a(n)
50  forall (j=1:n)
5180  a(n) = j
52  end forall
53  go to 80
54end subroutine sub03
55
56subroutine sub04(a,n)
57  real a(n)
58  where (a > 0)
5990  a = 1
60  elsewhere (a < 0)
6191  a = 2
62  elsewhere
6392  a = 3
64  end where
65  if (n - 3) 90, 91, 92
66end subroutine sub04
67
68subroutine sub05(a)
69  real a(..)
70  select rank (a)
71  rank(1)
7231  goto 30
73  rank(2)
74    goto 32
7532  continue
7630  continue
77  end select
78  goto 31
79end
80
81subroutine sub06(a)
82  class(*) a
83  select type (a)
84  type is (integer)
8541  goto 40
86  type is (real)
87    goto 42
8842  continue
8940  continue
90  end select
91  goto 41
92end
93