From fb7134e4e3a45fee4ab662ef0d467ef864c23e2e Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Mon, 26 Oct 2020 11:28:02 +0700 Subject: [PATCH] test: add index bounds check elided with "&^" 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 Run-TryBot: Cuong Manh Le TryBot-Result: Go Bot Reviewed-by: Matthew Dempsky --- test/bounds.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/bounds.go b/test/bounds.go index 34c444877b..4a9c3b2d39 100644 --- a/test/bounds.go +++ b/test/bounds.go @@ -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]) -- 2.50.0