golang/go

cmd/compile: internal compiler error: not lowered: v15, OffPtr PTR64 PTR64 on wasm

ALTree opened this issue · 3 comments

$ gotip version
go version devel +2c01b7d632 Tue Jun 5 16:49:07 2018 +0000 linux/amd64

The following program:

package p

func f() {
	var i int
	var s []string
	for true {
		i = -len("a")
		s[i] = ""
		s = []string{""}
	}
	_, _ = i, s
}

crashes the tip compiler when building for the wasm architecture:

$ GOARCH=wasm GOOS=js gotip build crash.go
# command-line-arguments
./crash.go:6:2: internal compiler error: not lowered: v15, OffPtr PTR64 PTR64

goroutine 10 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
	/home/alberto/go/src/runtime/debug/stack.go:24 +0xa7
cmd/compile/internal/gc.Fatalf(0xc9d685, 0x2, 0xc000046d30, 0x1, 0x1)
	/home/alberto/go/src/cmd/compile/internal/gc/subr.go:182 +0x1f7
cmd/compile/internal/gc.(*ssafn).Fatalf(0xc00007b9e0, 0x602100000002, 0xc9d685, 0x2, 0xc000046d30, 0x1, 0x1)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:5540 +0x67
cmd/compile/internal/ssa.(*Func).Fatalf(0xc0003582c0, 0xc9d685, 0x2, 0xc000046d30, 0x1, 0x1)
	/home/alberto/go/src/cmd/compile/internal/ssa/func.go:562 +0x73
cmd/compile/internal/ssa.checkLower(0xc0003582c0)
	/home/alberto/go/src/cmd/compile/internal/ssa/lower.go:36 +0x34d
cmd/compile/internal/ssa.Compile(0xc0003582c0)
	/home/alberto/go/src/cmd/compile/internal/ssa/compile.go:70 +0x300
cmd/compile/internal/gc.buildssa(0xc000358000, 0x3, 0x0)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:210 +0xaa7
cmd/compile/internal/gc.compileSSA(0xc000358000, 0x3)
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:259 +0x39
cmd/compile/internal/gc.compileFunctions.func2(0xc0004b8120, 0xc000012680, 0x3)
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:323 +0x49
created by cmd/compile/internal/gc.compileFunctions
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:321 +0x11a

The offending value is OffPtr <*string> [-16] v14. Wasm.rules didn't handle negative offset.

Change https://golang.org/cl/116595 mentions this issue: cmd/compile: fix OffPtr with negative offset on wasm