xref: /llvm-project/flang/test/Semantics/blockconstruct01.f90 (revision c3148e9f693b41fb52f8ffe940cb1390bc027e0f)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2! C1107 -- COMMON, EQUIVALENCE, INTENT, NAMELIST, OPTIONAL, VALUE or
3!          STATEMENT FUNCTIONS not allow in specification part
4
5subroutine s1_c1107
6  common /nl/x
7  block
8    !ERROR: COMMON statement is not allowed in a BLOCK construct
9    common /nl/y
10  end block
11end
12
13subroutine s2_c1107
14  real x(100), i(5)
15  integer y(100), j(5)
16  equivalence (x, y)
17  block
18   !ERROR: EQUIVALENCE statement is not allowed in a BLOCK construct
19   equivalence (i, j)
20  end block
21end
22
23subroutine s3_c1107(x_in, x_out)
24  integer x_in, x_out
25  intent(in) x_in
26  block
27    !ERROR: INTENT statement is not allowed in a BLOCK construct
28    intent(out) x_out
29  end block
30end
31
32subroutine s4_c1107
33  namelist /nl/x
34  block
35    !ERROR: NAMELIST statement is not allowed in a BLOCK construct
36    namelist /nl/y
37  end block
38end
39
40subroutine s5_c1107(x,y)
41  integer x, y
42  value x
43  block
44    !ERROR: VALUE statement is not allowed in a BLOCK construct
45    value y
46  end block
47end
48
49subroutine s6_c1107(x, y)
50  integer x, y
51  optional x
52  block
53    !ERROR: OPTIONAL statement is not allowed in a BLOCK construct
54    optional y
55  end block
56end
57
58subroutine s7_c1107
59 integer x, arr(1)
60 inc(x) = x + 1
61  block
62    !ERROR: A statement function definition may not appear in a BLOCK construct
63    dec(x) = x - 1
64    arr(x) = x - 1 ! ok
65  end block
66end
67
68subroutine s8
69  real x(1)
70  associate (sf=>x)
71    block
72      integer :: j = 1
73      sf(j) = j ! looks like a statement function, but isn't one
74    end block
75  end associate
76end
77