@@ -201,6 +201,11 @@ func h2(a []byte) {
201
201
202
202
func k0 (a [100 ]int ) [100 ]int {
203
203
for i := 10 ; i < 90 ; i ++ { // ERROR "Induction variable: limits \[10,90\), increment 1$"
204
+ if a [0 ] == 0xdeadbeef {
205
+ // This is a trick to prohibit sccp to optimize out the following out of bound check
206
+ continue
207
+ }
208
+ a [i - 11 ] = i
204
209
a [i - 10 ] = i // ERROR "(\([0-9]+\) )?Proved IsInBounds$"
205
210
a [i - 5 ] = i // ERROR "(\([0-9]+\) )?Proved IsInBounds$"
206
211
a [i ] = i // ERROR "(\([0-9]+\) )?Proved IsInBounds$"
@@ -213,6 +218,11 @@ func k0(a [100]int) [100]int {
213
218
214
219
func k1 (a [100 ]int ) [100 ]int {
215
220
for i := 10 ; i < 90 ; i ++ { // ERROR "Induction variable: limits \[10,90\), increment 1$"
221
+ if a [0 ] == 0xdeadbeef {
222
+ // This is a trick to prohibit sccp to optimize out the following out of bound check
223
+ continue
224
+ }
225
+ useSlice (a [:i - 11 ])
216
226
useSlice (a [:i - 10 ]) // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$"
217
227
useSlice (a [:i - 5 ]) // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$"
218
228
useSlice (a [:i ]) // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$"
@@ -227,6 +237,11 @@ func k1(a [100]int) [100]int {
227
237
228
238
func k2 (a [100 ]int ) [100 ]int {
229
239
for i := 10 ; i < 90 ; i ++ { // ERROR "Induction variable: limits \[10,90\), increment 1$"
240
+ if a [0 ] == 0xdeadbeef {
241
+ // This is a trick to prohibit sccp to optimize out the following out of bound check
242
+ continue
243
+ }
244
+ useSlice (a [i - 11 :])
230
245
useSlice (a [i - 10 :]) // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$"
231
246
useSlice (a [i - 5 :]) // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$"
232
247
useSlice (a [i :]) // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$"
@@ -240,6 +255,11 @@ func k2(a [100]int) [100]int {
240
255
241
256
func k3 (a [100 ]int ) [100 ]int {
242
257
for i := - 10 ; i < 90 ; i ++ { // ERROR "Induction variable: limits \[-10,90\), increment 1$"
258
+ if a [0 ] == 0xdeadbeef {
259
+ // This is a trick to prohibit sccp to optimize out the following out of bound check
260
+ continue
261
+ }
262
+ a [i + 9 ] = i
243
263
a [i + 10 ] = i // ERROR "(\([0-9]+\) )?Proved IsInBounds$"
244
264
a [i + 11 ] = i
245
265
}
@@ -248,16 +268,26 @@ func k3(a [100]int) [100]int {
248
268
249
269
func k3neg (a [100 ]int ) [100 ]int {
250
270
for i := 89 ; i > - 11 ; i -- { // ERROR "Induction variable: limits \(-11,89\], increment 1$"
271
+ if a [0 ] == 0xdeadbeef {
272
+ // This is a trick to prohibit sccp to optimize out the following out of bound check
273
+ continue
274
+ }
251
275
a [i + 9 ] = i
252
276
a [i + 10 ] = i // ERROR "(\([0-9]+\) )?Proved IsInBounds$"
277
+ a [i + 11 ] = i
253
278
}
254
279
return a
255
280
}
256
281
257
282
func k3neg2 (a [100 ]int ) [100 ]int {
258
283
for i := 89 ; i >= - 10 ; i -- { // ERROR "Induction variable: limits \[-10,89\], increment 1$"
284
+ if a [0 ] == 0xdeadbeef {
285
+ // This is a trick to prohibit sccp to optimize out the following out of bound check
286
+ continue
287
+ }
259
288
a [i + 9 ] = i
260
289
a [i + 10 ] = i // ERROR "(\([0-9]+\) )?Proved IsInBounds$"
290
+ a [i + 11 ] = i
261
291
}
262
292
return a
263
293
}
0 commit comments