xref: /llvm-project/flang/test/Semantics/resolve61.f90 (revision f50f0caf87d762ca1c4a0122bd29d2fc9c667113)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2subroutine p1
3  integer(8) :: a, b, c, d
4  pointer(a, b)
5  !ERROR: 'b' cannot be a Cray pointer as it is already a Cray pointee
6  pointer(b, c)
7  !ERROR: 'a' cannot be a Cray pointee as it is already a Cray pointer
8  pointer(d, a)
9end
10
11subroutine p2
12  pointer(a, c)
13  !ERROR: 'c' was already declared as a Cray pointee
14  pointer(b, c)
15end
16
17subroutine p3
18  real a
19  !ERROR: Cray pointer 'a' must have type INTEGER(8)
20  pointer(a, b)
21end
22
23subroutine p4
24  implicit none
25  real b
26  !ERROR: No explicit type declared for 'd'
27  pointer(a, b), (c, d)
28end
29
30subroutine p5
31  integer(8) a(10)
32  !ERROR: Cray pointer 'a' must be a scalar
33  pointer(a, b)
34end
35
36subroutine p6
37  real b(8)
38  !ERROR: The dimensions of 'b' have already been declared
39  pointer(a, b(4))
40end
41
42subroutine p7
43  !ERROR: Cray pointee 'b' must have explicit shape or assumed size
44  pointer(a, b(:))
45contains
46  subroutine s(x, y)
47    real :: x(*)  ! assumed size
48    !ERROR: Cray pointee 'y' must have explicit shape or assumed size
49    real :: y(:)  ! assumed shape
50    pointer(w, y)
51  end
52end
53
54subroutine p8
55  integer(8), parameter :: k = 2
56  type t
57  end type
58  !ERROR: 't' is not a variable
59  pointer(t, a)
60  !ERROR: 's' is not a variable
61  pointer(s, b)
62  !ERROR: 'k' is a named constant and may not be a Cray pointer
63  pointer(k, c)
64contains
65  subroutine s
66  end
67end
68
69subroutine p9
70  integer(8), parameter :: k = 2
71  type t
72  end type
73  !ERROR: 't' is already declared in this scoping unit
74  pointer(a, t)
75  !ERROR: Declaration of 's' conflicts with its use as internal procedure
76  pointer(b, s)
77  !ERROR: 'k' is a named constant and may not be a Cray pointee
78  pointer(c, k)
79contains
80  subroutine s
81  end
82end
83
84module m10
85  integer(8) :: a
86  real :: b
87end
88subroutine p10
89  use m10
90  !ERROR: 'b' is use-associated from module 'm10' and cannot be re-declared
91  pointer(a, c),(d, b)
92end
93
94subroutine p11
95  pointer(a, b)
96  !ERROR: PARAMETER attribute not allowed on 'a'
97  parameter(a=2)
98  !ERROR: PARAMETER attribute not allowed on 'b'
99  parameter(b=3)
100end
101
102subroutine p12
103  type t1
104    sequence
105    real c1
106  end type
107  type t2
108    integer c2
109  end type
110  type, bind(c) :: t3
111    integer c3
112  end type
113  type(t1) :: x1
114  type(t2) :: x2
115  type(t3) :: x3
116  pointer(a, x1)
117  !WARNING: Type of Cray pointee 'x2' is a derived type that is neither SEQUENCE nor BIND(C)
118  pointer(b, x2)
119  pointer(c, x3)
120end
121
122subroutine p13
123  pointer(ip, x)
124 contains
125  subroutine s
126    pointer(ip, x) ! ok, local declaration
127  end
128end
129
130subroutine p14
131  real :: r
132  block
133    asynchronous :: r
134    !ERROR: PARAMETER attribute not allowed on 'r'
135    parameter (r = 1.0)
136  end block
137end
138