summaryrefslogtreecommitdiff
path: root/test/loopbce.go
diff options
context:
space:
mode:
authorKeith Randall <keithr@alum.mit.edu>2019-03-08 15:01:32 -0800
committerKeith Randall <khr@golang.org>2019-03-09 00:52:45 +0000
commit83a33d3855e257b383b2a3a10dfd9748ad17cfb4 (patch)
treebbb02b368504c00b5dc20a2d960ff05cb3fb5734 /test/loopbce.go
parent3cf89e509b21d0f469c4e0a78179b9d2d961c864 (diff)
downloadgo-git-83a33d3855e257b383b2a3a10dfd9748ad17cfb4.tar.gz
cmd/compile: reverse order of slice bounds checks
Turns out this makes the fix for 28797 unnecessary, because this order ensures that the RHS of IsSliceInBounds ops are always nonnegative. The real reason for this change is that it also makes dealing with <0 values easier for reporting values in bounds check panics (issue #30116). Makes cmd/go negligibly smaller. Update #28797 Change-Id: I1f25ba6d2b3b3d4a72df3105828aa0a4b629ce85 Reviewed-on: https://go-review.googlesource.com/c/go/+/166377 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'test/loopbce.go')
-rw-r--r--test/loopbce.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/loopbce.go b/test/loopbce.go
index 81f2524e95..e0a6463c5e 100644
--- a/test/loopbce.go
+++ b/test/loopbce.go
@@ -63,7 +63,7 @@ func f5(a [10]int) int {
func f6(a []int) {
for i := range a { // ERROR "Induction variable: limits \[0,\?\), increment 1$"
- b := a[0:i] // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$" "(\([0-9]+\) )?Proved Geq64$"
+ b := a[0:i] // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$"
f6(b)
}
}
@@ -186,10 +186,10 @@ func k0(a [100]int) [100]int {
func k1(a [100]int) [100]int {
for i := 10; i < 90; i++ { // ERROR "Induction variable: limits \[10,90\), increment 1$"
- useSlice(a[:i-11]) // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$"
+ useSlice(a[:i-11])
useSlice(a[:i-10]) // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$"
useSlice(a[:i-5]) // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$"
- useSlice(a[:i]) // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$" "(\([0-9]+\) )?Proved Geq64$"
+ useSlice(a[:i]) // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$"
useSlice(a[:i+5]) // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$"
useSlice(a[:i+10]) // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$"
useSlice(a[:i+11]) // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$"