@randall77 It looks perhaps like the fix for #23504 didn't make it to 1.10.x releases (it's not in 1.9.x either, but I already patch those locally and am upgrading so less concerned).
Cherry picking the fix (4313d77) and rebuilding 1.10.3 works as expected for me.
What version of Go are you using (go version)?
go version go1.10.3 linux/amd64
What did you do?
https://play.golang.org/p/OWxLKfWXnnh
go build of
package main
func f(op string) {
for len(op) > 1 && !(op[0] >= '0' || op[0] <= '9') {
}
}
func main() {
f("x")
}
What did you expect to see?
... no output ...
What did you see instead?
prog.go:4:16: internal compiler error: panic during layout while compiling f:
runtime error: index out of range
goroutine 7 [running]:
cmd/compile/internal/ssa.Compile.func1(0xc4203f3288, 0xc42000e500)
/usr/local/go/src/cmd/compile/internal/ssa/compile.go:38 +0xc8
panic(0xbbc700, 0xf9d830)
/usr/local/go/src/runtime/panic.go:502 +0x229
cmd/compile/internal/ssa.layout(0xc42000e500)
/usr/local/go/src/cmd/compile/internal/ssa/layout.go:68 +0xdca
cmd/compile/internal/ssa.Compile(0xc42000e500)
/usr/local/go/src/cmd/compile/internal/ssa/compile.go:70 +0x2bb
cmd/compile/internal/gc.buildssa(0xc420001200, 0x1, 0x0)
/usr/local/go/src/cmd/compile/internal/gc/ssa.go:223 +0xb32
cmd/compile/internal/gc.compileSSA(0xc420001200, 0x1)
/usr/local/go/src/cmd/compile/internal/gc/pgen.go:239 +0x39
cmd/compile/internal/gc.compileFunctions.func2(0xc4203e8180, 0xc4200125a0, 0x1)
/usr/local/go/src/cmd/compile/internal/gc/pgen.go:289 +0x49
created by cmd/compile/internal/gc.compileFunctions
/usr/local/go/src/cmd/compile/internal/gc/pgen.go:287 +0x11c
Please file a bug report including a short program that triggers the error.
https://golang.org/issue/new
(apologies, this is the output from the playground as i now have it fixed locally so no error and am too lazy to rebuild it 'broken' right now)
@randall77 It looks perhaps like the fix for #23504 didn't make it to 1.10.x releases (it's not in 1.9.x either, but I already patch those locally and am upgrading so less concerned).
Cherry picking the fix (4313d77) and rebuilding
1.10.3works as expected for me.What version of Go are you using (
go version)?go version go1.10.3 linux/amd64
What did you do?
https://play.golang.org/p/OWxLKfWXnnh
go buildofWhat did you expect to see?
... no output ...
What did you see instead?
(apologies, this is the output from the playground as i now have it fixed locally so no error and am too lazy to rebuild it 'broken' right now)