34
34
type Array_Type is array (PST1 range <>) of String (1..10);
35
35
type Array_Type1 is array (PST1 range <>) of String (PST1'FIRST .. PST1'LAST); -- Should trigger
36
36
type Array_Type2 is array (PST1 range <>) of String (PST1'RANGE); -- Should trigger
37
type Array_Type3 is array (PST1 range <>) of String (PST1'FIRST .. PST2'LAST); -- Should not trigger
37
type Array_Type3 is array (PST1 range <>) of String (PST1'FIRST .. PST2'LAST); -- OK
38
38
type Array_Type4 is new Array_Type3 (1..2);
40
40
subtype ST1A is Array_Type (PST1'FIRST .. PST1'LAST); -- Should trigger
41
41
subtype ST2A is Array_Type (PST1'RANGE); -- Should trigger
42
subtype ST3A is Array_Type (PST1'FIRST .. PST2'LAST); -- Should not trigger
42
subtype ST3A is Array_Type (PST1'FIRST .. PST2'LAST); -- OK
80
80
for X in Pack.T'First .. Pack.T'Last loop -- Should trigger
83
for X in T'Base'First .. T'Last loop -- Should not trigger
86
for X in Btype'FIRST .. Btype (Ctype'LAST) loop -- Should not trigger
89
for X in Btype (CType'FIRST) .. Btype'LAST loop -- Should not trigger
92
for X in Btype'FIRST .. Btype'LAST-1 loop -- Should not trigger
95
for X in Btype'FIRST-1 .. Btype'LAST loop -- Should not trigger
98
for X in Btype'LAST .. Btype'FIRST loop -- Should not trigger
83
for X in T'Base'First .. T'Last loop -- OK
86
for X in Btype'FIRST .. Btype (Ctype'LAST) loop -- OK
89
for X in Btype (CType'FIRST) .. Btype'LAST loop -- OK
92
for X in Btype'FIRST .. Btype'LAST-1 loop -- OK
95
for X in Btype'FIRST-1 .. Btype'LAST loop -- OK
98
for X in Btype'LAST .. Btype'FIRST loop -- OK
101
101
for X in Btype'FIRST .. Btype'LAST loop -- Should trigger
114
114
for X in ASA'FIRST .. ASA'LAST loop -- Should trigger
115
ASA(X)(ASA(X)'RANGE) := (others => ' '); -- Should not trigger
115
ASA(X)(ASA(X)'RANGE) := (others => ' '); -- OK
117
for X in ASA'RANGE loop -- Should not trigger
117
for X in ASA'RANGE loop -- OK
118
118
ASA(X)(ASA(X)'FIRST .. ASA(X)'LAST) := (others => ' '); -- Should trigger
119
ASA(X)(ASA(X)'FIRST .. ASA(Ix1)'LAST) := (others => ' '); -- Should not trigger
120
ASA(X)(ASA(X)'FIRST .. A_Var) := (others => ' '); -- Should not trigger
121
ASA(X)(A_Var .. ASA(X)'LAST) := (others => ' '); -- Should not trigger
119
ASA(X)(ASA(X)'FIRST .. ASA(Ix1)'LAST) := (others => ' '); -- OK
120
ASA(X)(ASA(X)'FIRST .. A_Var) := (others => ' '); -- OK
121
ASA(X)(A_Var .. ASA(X)'LAST) := (others => ' '); -- OK
123
123
ASA (ASA'FIRST (1) .. ASA'LAST (1)) := (others => (others => ' ')); -- Should trigger
124
ASA (ASA'RANGE (1)) := (others => (others => ' ')); -- Should not trigger
124
ASA (ASA'RANGE (1)) := (others => (others => ' ')); -- OK
125
125
ASA(1)(ASA(Ix1)'FIRST .. ASA(Ix1)'LAST) := (others => ' '); -- Should trigger
126
ASA(1)(ASA(Ix1)'FIRST .. ASA(Ix2)'LAST) := (others => ' '); -- Should not trigger
126
ASA(1)(ASA(Ix1)'FIRST .. ASA(Ix2)'LAST) := (others => ' '); -- OK
128
128
SA1 (ST1A'FIRST .. ST1A'LAST) := (others => (others => ' ')); -- Should trigger
129
SA1 (ST1A'FIRST .. ST2A'LAST) := (others => (others => ' ')); -- Should not trigger
129
SA1 (ST1A'FIRST .. ST2A'LAST) := (others => (others => ' ')); -- OK
130
130
SA2 (ST1A'FIRST .. ST1A'LAST) := (others => (others => ' ')); -- Should trigger
132
ASA (PST1) := (others => (others => ' ')); -- Should not trigger
132
ASA (PST1) := (others => (others => ' ')); -- OK
133
133
ASA (PST1'FIRST .. PST1'LAST) := (others => (others => ' ')); -- Should trigger
134
134
ASA (PST2'FIRST .. PST2'LAST) := (others => (others => ' ')); -- Should trigger
135
ASA (PST1'FIRST .. PST2'LAST) := (others => (others => ' ')); -- Should not trigger
135
ASA (PST1'FIRST .. PST2'LAST) := (others => (others => ' ')); -- OK
137
ASB (PST1) := (others => (others => ' ')); -- Should not trigger
137
ASB (PST1) := (others => (others => ' ')); -- OK
138
138
ASB (PST1'BASE'FIRST .. PST1'BASE'LAST) := (others => (others => ' ')); -- Should trigger
139
ASB (PST1'BASE'FIRST .. PST1'LAST) := (others => (others => ' ')); -- Should not trigger
140
ASB (PST1'FIRST .. PST2'LAST) := (others => (others => ' ')); -- Should not trigger
139
ASB (PST1'BASE'FIRST .. PST1'LAST) := (others => (others => ' ')); -- OK
140
ASB (PST1'FIRST .. PST2'LAST) := (others => (others => ' ')); -- OK
141
141
ASB (ASB'FIRST .. ASB'LAST) := (others => (others => ' ')); -- Should trigger
143
143
for I in Renaming'First..Renaming'Last loop -- Should trigger
147
for I in Renaming'Range loop -- Should not trigger
147
for I in Renaming'Range loop -- OK
151
for I in Array_Type4'range loop -- Should not trigger
151
for I in Array_Type4'range loop -- OK
164
A : Boolean := Y = False;
165
B : constant Boolean := Y = False;
164
A : Boolean := Y = False; -- Should trigger
165
B : constant Boolean := Y = False; -- Should trigger
167
procedure Z (P : in Boolean := Y = False) is
167
procedure Z (P : in Boolean := Y = False) is -- Should trigger
174
if X = False and then Y = True then
174
if X = False and then Y = True then -- Should trigger (twice)
178
elsif X /= False then
186
elsif False /= X then
176
elsif X = False then -- Should trigger
177
X := Y = False; -- Should trigger
178
elsif X /= False then -- Should trigger
180
elsif X = True then -- Should trigger
182
elsif X /= True then -- Should trigger
184
elsif False = X then -- Should trigger
186
elsif False /= X then -- Should trigger
188
elsif True = X then -- Should trigger
190
elsif True /= X then -- Should trigger
194
while Y = False and X = False loop
194
while Y = False and X = False loop -- Should trigger (twice)
197
197
end Test_Logical;
199
199
procedure Test_Parentheses is
200
I : Integer := 1; -- OK
201
J : Integer := (1); -- Should Trigger
203
procedure P (X : Integer) is
210
I := (1); -- Should Trigger
213
if (B) then -- Should Trigger
215
elsif (B) then -- Should Trigger
224
case (B) is -- Should Trigger
233
P ((1)); -- Should Trigger
237
I := 1 + (2*3); -- Should Trigger
238
I := (1) + 2*3; -- Should Trigger
239
I := 1 * (2+3); -- OK
240
I := 1 * ("+"(2, 3)); -- Should Trigger
241
I := "*"(1, (2+3)); -- Should Trigger
242
I := 3 + abs (I); -- Should Trigger
243
I := 3 + (abs I); -- Should Trigger
244
I := I ** (3); -- Should Trigger
245
I := I ** (3+1); -- OK
246
I := (I+1) ** 3; -- OK
249
B := I = 1 or (I = 2 or I = 3); -- OK (removing parentheses changes associativity)
250
B := I = 1 or (I = 2 and I = 3); -- OK
251
B := not (B); -- Should Trigger
252
B := not (B and B); -- OK
253
B := (not B) and B; -- Should Trigger
256
B := I = 1 or (I = 2 and then I = 3); -- OK
257
B := I = 1 or else (I = 2 and then I = 3); -- OK
258
B := I = 1 and then (I = 2 and then I = 3); -- Should Trigger
259
B := I = 1 and then (I = 2); -- Should Trigger
260
B := I = 1 and then (B or B); -- OK
261
B := (I = 1) and then B; -- Should Trigger
262
B := I = 1 and then (B); -- Should Trigger
263
B := I = 1 and then ("or" (B, B)); -- Should Trigger
222
264
end Test_Parentheses;