1
0
mirror of https://github.com/golang/go synced 2024-10-05 18:21:21 -06:00
go/src/cmd
Keith Randall 46e62f873a [dev.ssa] cmd/compile: used Bounded field to fix empty range loops
for i, v := range a {
    }

Walk converts this to a regular for loop, like this:

    for i := 0, p := &a[0]; i < len(a); i++, p++ {
        v := *p
    }

Unfortunately, &a[0] fails its bounds check when a is
the empty slice (or string).  The old compiler gets around this
by marking &a[0] as Bounded, meaning "don't emit bounds checks
for this index op".  This change makes SSA honor that same mark.

The SSA compiler hasn't implemented bounds check panics yet,
so the failed bounds check just causes the current routine
to return immediately.

Fixes bytes package tests.

Change-Id: Ibe838853ef4046c92f76adbded8cca3b1e449e0b
Reviewed-on: https://go-review.googlesource.com/13685
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-08-19 21:44:44 +00:00
..
addr2line cmd/addr2line: simplify windows test 2015-06-17 14:23:20 +00:00
api api: add go1.5.txt API file, reset next.txt 2015-07-21 02:48:35 +00:00
asm cmd/asm: fix and test CALL, JMP aliases on arm, arm64, ppc64 2015-07-28 14:19:53 +00:00
cgo cmd/cgo: discard trailing zero-sized fields in a non-empty C struct 2015-07-30 15:55:25 +00:00
compile [dev.ssa] cmd/compile: used Bounded field to fix empty range loops 2015-08-19 21:44:44 +00:00
cover all: extract "can I exec?" check from tests into internal/testenv 2015-06-16 18:07:36 +00:00
dist [dev.ssa] Merge remote-tracking branch 'origin/master' into mergebranch 2015-07-30 12:30:48 -07:00
doc cmd/doc: extend darwin/arm64 test TODO to arm 2015-07-28 17:39:19 +00:00
fix cmd/fix: add gotypes module 2015-07-17 01:47:14 +00:00
go cmd: delete old[5689]a 2015-07-29 03:45:26 +00:00
gofmt
internal [dev.ssa] cmd/compile: fix dev.ssa build 2015-08-17 15:01:55 +00:00
link cmd/link: fix nosplit stack overflow checks 2015-07-29 21:36:16 +00:00
newlink cmd/link: elide individual gcbits symbols 2015-07-22 20:27:24 +00:00
nm all: extract "can I exec?" check from tests into internal/testenv 2015-06-16 18:07:36 +00:00
objdump all: extract "can I exec?" check from tests into internal/testenv 2015-06-16 18:07:36 +00:00
pack all: extract "can I exec?" check from tests into internal/testenv 2015-06-16 18:07:36 +00:00
pprof cmd/pprof: fix race between viewer and web command 2015-07-23 03:51:39 +00:00
trace runtime/trace: add new package 2015-07-22 15:47:16 +00:00
vet all: link to https instead of http 2015-07-11 14:36:33 +00:00
yacc all: fix misprints in comments 2015-06-11 14:18:57 +00:00