golang/go

cmd/compile: internal compiler error: arg 0 of value v4 = Load <int> v19 v8 does not dominate (with ssacheck)

ALTree opened this issue · 3 comments

$ go version
go version go1.17 linux/amd64
$ gotip version
go version devel go1.18-6a35e07512 Fri Aug 27 16:41:29 2021 +0000 linux/amd64
package p

var i int

type t struct {
	a, b, c, d, e int
}

func f(p t, q int) int {
	var a, b, c, d, e, f, g int
	var h, i, j, k, l, m int
	_, _, _, _, _, _, _ = a, b, c, d, e, f, g
	_, _, _, _, _, _ = h, i, j, k, l, m
	return 0
}

func g() int {
	var v t
	return f(v, 1<<i)
}
$ go build -gcflags=-d=ssa/check/seed=1 crash.go

# command-line-arguments
./crash.go:19:14: internal compiler error: 'g': arg 0 of value v4 = Load <int> v20 v9 does not dominate, arg=v20 = OffPtr <*int> [8] v10

Please file a bug report including a short program that triggers the error.

Go 1.16 is not affected.

cc @randall77 @josharian

@dr2chase Looks like this is happening in expandCalls.

/Users/khr/gowork/issue48026.go:19:14: internal compiler error: 'g': arg 0 of value v4 = Load <int> v19 v8 does not dominate, arg=v19 = OffPtr <*int> [8] v9

b1:
   v4 (+19) = Load <int> v19 v8
   If v14 → b2 b3 (likely) (+19)
b2: ← b1
   v19 (19) = OffPtr <*int> [8] v9

The OffPtr was put in the block following the block of the Load that is using it.

The problem seems to be in storeOneLoad, we emit OffPtr in the input b, but the do the Load in source.Block.

Change https://golang.org/cl/345434 mentions this issue: cmd/compile: fix offset-generator for storeOneLoad