1! RUN: %S/test_errors.sh %s %t %f18
2subroutine s1
3  !ERROR: Array 'z' without ALLOCATABLE or POINTER attribute must have explicit shape
4  common x, y(4), z(:)
5end
6
7subroutine s2
8  common /c1/ x, y, z
9  !ERROR: 'y' is already in a COMMON block
10  common y
11end
12
13subroutine s3
14  procedure(real) :: x
15  !ERROR: 'x' is already declared as a procedure
16  common x
17  common y
18  !ERROR: 'y' is already declared as an object
19  procedure(real) :: y
20end
21
22subroutine s5
23  integer x(2)
24  !ERROR: The dimensions of 'x' have already been declared
25  common x(4), y(4)
26  !ERROR: The dimensions of 'y' have already been declared
27  real y(2)
28end
29
30function f6(x) result(r)
31  !ERROR: Dummy argument 'x' may not appear in a COMMON block
32  !ERROR: ALLOCATABLE object 'y' may not appear in a COMMON block
33  common x,y,z
34  allocatable y
35  !ERROR: Function result 'r' may not appear in a COMMON block
36  common r
37end
38
39module m7
40  !ERROR: Variable 'w' with BIND attribute may not appear in a COMMON block
41  !ERROR: Variable 'z' with BIND attribute may not appear in a COMMON block
42  common w,z
43  integer, bind(c) :: z
44  integer, bind(c,name="w") :: w
45end
46
47module m8
48  type t
49  end type
50  class(*), pointer :: x
51  !ERROR: Unlimited polymorphic pointer 'x' may not appear in a COMMON block
52  !ERROR: Unlimited polymorphic pointer 'y' may not appear in a COMMON block
53  common x, y
54  class(*), pointer :: y
55end
56
57module m9
58  integer x
59end
60subroutine s9
61  use m9
62  !ERROR: 'x' is use-associated from module 'm9' and cannot be re-declared
63  common x
64end
65
66module m10
67  type t
68  end type
69  type(t) :: x
70  !ERROR: Derived type 'x' in COMMON block must have the BIND or SEQUENCE attribute
71  common x
72end
73
74module m11
75  type t1
76    sequence
77    integer, allocatable :: a
78  end type
79  type t2
80    sequence
81    type(t1) :: b
82    integer:: c
83  end type
84  type(t2) :: x2
85  !ERROR: Derived type variable 'x2' may not appear in a COMMON block due to ALLOCATABLE component
86  common x2
87end
88
89module m12
90  type t1
91    sequence
92    integer :: a = 123
93  end type
94  type t2
95    sequence
96    type(t1) :: b
97    integer:: c
98  end type
99  type(t2) :: x2
100  !ERROR: Derived type variable 'x2' may not appear in a COMMON block due to component with default initialization
101  common x2
102end
103
104subroutine s13
105  block
106    !ERROR: COMMON statement is not allowed in a BLOCK construct
107    common x
108  end block
109end
110
111subroutine s14
112  !ERROR: 'c' appears as a COMMON block in a BIND statement but not in a COMMON statement
113  bind(c) :: /c/
114end
115