What version of Go are you using (go version)?
$ go version
go version go1.17 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
What did you do?
package main
import (
"io"
)
type Writer interface {
io.Writer
io.StringWriter
io.ByteWriter
}
func writeString[T Writer](w T, s string) {
w.WriteString(s)
}
func WriteString(w Writer, s string) {
writeString[Writer](w, s)
}
func main() {
}
Attempting to build with go build -gcflags="-G=3" main.go
What did you expect to see?
No panic
What did you see instead?
# command-line-arguments
panic: runtime error: index out of range [-1]
goroutine 1 [running]:
cmd/compile/internal/ssagen.(*state).peekPos(...)
/usr/local/go/src/cmd/compile/internal/ssagen/ssa.go:1061
cmd/compile/internal/ssagen.(*state).pushLine(0xc000150200, {0x44cb14, 0x0})
/usr/local/go/src/cmd/compile/internal/ssagen/ssa.go:1043 +0x147
cmd/compile/internal/ssagen.buildssa(0xc00001eb00, 0x0)
/usr/local/go/src/cmd/compile/internal/ssagen/ssa.go:420 +0x497
cmd/compile/internal/ssagen.Compile(0xc00001eb00, 0xc0000c6d00)
/usr/local/go/src/cmd/compile/internal/ssagen/pgen.go:165 +0x4c
cmd/compile/internal/gc.compileFunctions.func4.1(0x1)
/usr/local/go/src/cmd/compile/internal/gc/compile.go:153 +0x3a
cmd/compile/internal/gc.compileFunctions.func2(0x0)
/usr/local/go/src/cmd/compile/internal/gc/compile.go:125 +0x1e
cmd/compile/internal/gc.compileFunctions.func4({0xc0000c6ca0, 0x4, 0x4})
/usr/local/go/src/cmd/compile/internal/gc/compile.go:152 +0x53
cmd/compile/internal/gc.compileFunctions()
/usr/local/go/src/cmd/compile/internal/gc/compile.go:163 +0x162
cmd/compile/internal/gc.Main(0xd16450)
/usr/local/go/src/cmd/compile/internal/gc/main.go:287 +0xf3a
main.main()
/usr/local/go/src/cmd/compile/main.go:55 +0xdd
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
Attempting to build with
go build -gcflags="-G=3" main.goWhat did you expect to see?
No panic
What did you see instead?