Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / resolve61.f90
blob73f6ccbf966691bec9a57f54ba8e07b0e186fabc
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 subroutine 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)
9 end
11 subroutine p2
12 pointer(a, c)
13 !ERROR: 'c' was already declared as a Cray pointee
14 pointer(b, c)
15 end
17 subroutine p3
18 real a
19 !ERROR: Cray pointer 'a' must have type INTEGER(8)
20 pointer(a, b)
21 end
23 subroutine p4
24 implicit none
25 real b
26 !ERROR: No explicit type declared for 'd'
27 pointer(a, b), (c, d)
28 end
30 subroutine p5
31 integer(8) a(10)
32 !ERROR: Cray pointer 'a' must be a scalar
33 pointer(a, b)
34 end
36 subroutine p6
37 real b(8)
38 !ERROR: Array spec was already declared for 'b'
39 pointer(a, b(4))
40 end
42 subroutine p7
43 !ERROR: Cray pointee 'b' must have explicit shape or assumed size
44 pointer(a, b(:))
45 contains
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
52 end
54 subroutine 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 not a variable
63 pointer(k, c)
64 contains
65 subroutine s
66 end
67 end
69 subroutine p9
70 integer(8), parameter :: k = 2
71 type t
72 end type
73 !ERROR: 't' is not a variable
74 pointer(a, t)
75 !ERROR: 's' is not a variable
76 pointer(b, s)
77 !ERROR: 'k' is not a variable
78 pointer(c, k)
79 contains
80 subroutine s
81 end
82 end
84 module m10
85 integer(8) :: a
86 real :: b
87 end
88 subroutine p10
89 use m10
90 !ERROR: 'b' cannot be a Cray pointee as it is use-associated
91 pointer(a, c),(d, b)
92 end
94 subroutine 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)
102 subroutine p12
103 type t1
104 sequence
105 real c1
106 end type
107 type t2
108 integer c2
109 end type
110 type(t1) :: x1
111 type(t2) :: x2
112 pointer(a, x1)
113 !ERROR: Type of Cray pointee 'x2' is a non-sequence derived type
114 pointer(b, x2)