2 // errorcheck -0 -d=ssa/check_bce/debug=3
7 a[0] = 1 // ERROR "Found IsInBounds$"
9 a[6] = 1 // ERROR "Found IsInBounds$"
15 func f1(a [256]int, i int) {
16 useInt(a[i]) // ERROR "Found IsInBounds$"
17 useInt(a[i%256]) // ERROR "Found IsInBounds$"
21 if 4 <= i && i < len(a) {
23 useInt(a[i-1]) // ERROR "Found IsInBounds$"
24 useInt(a[i-4]) // ERROR "Found IsInBounds$"
28 func f2(a [256]int, i uint) {
29 useInt(a[i]) // ERROR "Found IsInBounds$"
35 func f3(a [256]int, i uint8) {
41 func f4(a [27]int, i uint8) {
51 useSlice(a[:6]) // ERROR "Found IsSliceInBounds$"
55 func f6(a [32]int, b [64]int, i int) {
56 useInt(a[uint32(i*0x07C4ACDD)>>27])
57 useInt(b[uint64(i*0x07C4ACDD)>>58])
58 useInt(a[uint(i*0x07C4ACDD)>>59])
60 // The following bounds should not be removed because they can overflow.
61 useInt(a[uint32(i*0x106297f105d0cc86)>>26]) // ERROR "Found IsInBounds$"
62 useInt(b[uint64(i*0x106297f105d0cc86)>>57]) // ERROR "Found IsInBounds$"
63 useInt(a[int32(i*0x106297f105d0cc86)>>26]) // ERROR "Found IsInBounds$"
64 useInt(b[int64(i*0x106297f105d0cc86)>>57]) // ERROR "Found IsInBounds$"
76 useInt(a[3]) // ERROR "Found IsInBounds$"
83 for i := range a[:256] { // ERROR "Found IsSliceInBounds$"
84 useInt(a[i]) // ERROR "Found IsInBounds$"
93 for i := 10; i < 50; i++ {
99 // The following are out of bounds.
100 useInt(a[i-11]) // ERROR "Found IsInBounds$"
101 useInt(a[i+51]) // ERROR "Found IsInBounds$"
110 func useSlice(a []int) {