Repository navigation
Open
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
What version of Go are you using (go version)?
$ go version go version go1.15.6 darwin/amd64
Does this issue reproduce with the latest release?
Yes, it's present in go1.16beta1 too.
What operating system and processor architecture are you using (go env)?
go env Output
$ go env GO111MODULE="auto" GOARCH="amd64" GOBIN="" GOCACHE="/Users/mbm/Library/Caches/go-build" GOENV="/Users/mbm/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/mbm/Development/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/mbm/Development/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/Cellar/go/1.15.6/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.15.6/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/mbm/Development/avo/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/cj/jl6w0c1j4sz5vs05h5l1cby40000gn/T/go-build260372576=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
Assembling the following code:
TEXT ·test(SB), 0, $0
VGATHERDPD 32(Y13*8), Z17
RETWhat did you expect to see?
Assembler should produce an error.
What did you see instead?
$ go tool asm panic.s
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1189ec2]
goroutine 1 [running]:
cmd/internal/obj/x86.(*AsmBuf).doasm(0xc0000bfb90, 0xc00009c820, 0xc0000ce100, 0xc0000935f0)
/usr/local/Cellar/go/1.15.6/libexec/src/cmd/internal/obj/x86/asm6.go:4235 +0x74e2
cmd/internal/obj/x86.(*AsmBuf).asmins(0xc0000bfb90, 0xc00009c820, 0xc0000ce100, 0xc0000935f0)
/usr/local/Cellar/go/1.15.6/libexec/src/cmd/internal/obj/x86/asm6.go:5382 +0x65
cmd/internal/obj/x86.span6(0xc00009c820, 0xc0000ce100, 0xc00008e540)
/usr/local/Cellar/go/1.15.6/libexec/src/cmd/internal/obj/x86/asm6.go:2154 +0x545
cmd/internal/obj.Flushplist(0xc00009c820, 0xc0000bfe30, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.15.6/libexec/src/cmd/internal/obj/plist.go:107 +0x762
main.main()
/usr/local/Cellar/go/1.15.6/libexec/src/cmd/asm/main.go:91 +0x74b
I'm guessing this is an unsafe use of p.GetFrom3():
go/src/cmd/internal/obj/x86/asm6.go
Line 4231 in 4fd9455
| if p.GetFrom3().Reg >= REG_K0 && p.GetFrom3().Reg <= REG_K7 { |
Metadata
Metadata
Assignees
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
- StatusShow more project fieldsTriage Backlog
Activity
IBlackVoid commentedon Nov 5, 2026
This looks already fixed. On tip the instruction from the report produces a diagnostic instead of a crash:
The guard is the
p.GetFrom3() == nilcheck the report guessed at. It went in with b958d4a ("cmd/asm: don't panic on bad GATHER x86 instructions") in March 2023, filed against #58822, which is probably why this issue never got closed.I also tried two operand forms of VPGATHERQQ, VGATHERQPD, VPGATHERDD, VGATHERDPS and VPGATHERQD, all of them clean, and the correct three operand form still assembles.
Looks safe to close.