]> Cypherpunks repositories - gostls13.git/commitdiff
test: add index bounds check elided with "&^"
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Mon, 26 Oct 2020 04:28:02 +0000 (11:28 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Tue, 27 Oct 2020 02:33:40 +0000 (02:33 +0000)
For follow up CL, which will defer lowering OANDNOT until SSA.

Change-Id: I5a988d0b8f0ae664580f08b123811b2a31ef55c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/265040
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
test/bounds.go

index 34c444877baae490eed3f41b01b7de27d146bb55..4a9c3b2d39a2261e53ef3a8763f54aee1e0397c8 100644 (file)
@@ -201,6 +201,15 @@ func main() {
        use(p1k[ui&1000])
        use(p100k[ui&1000]) // ERROR "index bounds check elided"
 
+       use(a1[i&^-1]) // ERROR "index bounds check elided"
+       use(a1[i&^0])
+       use(a1[i&^-2])
+       use(a1[i&^1])
+       use(a1k[i&^-1]) // ERROR "index bounds check elided"
+       use(a1k[i&^0])
+       use(a1k[i&^-2]) // ERROR "index bounds check elided"
+       use(a1k[i&^1])
+
        // Right shift cuts the effective number of bits in the index,
        // but only for unsigned (signed stays negative).
        use(s[i32>>22])