aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2023-03-01 22:32:46 -0800
committerKeith Randall <khr@google.com>2023-03-02 15:57:24 +0000
commitb958d4a597a599e22c78d25d83d803ab2a1f2c52 (patch)
treebf5c23f2cde7ec22e42d91bfc0c72124e8ff25b6 /src/cmd
parent2f9e38a1be0b2e09898dac261ae8894dcb2594a0 (diff)
downloadgo-b958d4a597a599e22c78d25d83d803ab2a1f2c52.tar.xz
cmd/asm: don't panic on bad GATHER x86 instructions
Fixes #58822 Change-Id: I9c44c57dac72884ec3209d87ddb25e7e1675a737 Reviewed-on: https://go-review.googlesource.com/c/go/+/472795 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Rob Pike <r@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/internal/obj/x86/asm6.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/internal/obj/x86/asm6.go b/src/cmd/internal/obj/x86/asm6.go
index b441964492..0e8670c8e5 100644
--- a/src/cmd/internal/obj/x86/asm6.go
+++ b/src/cmd/internal/obj/x86/asm6.go
@@ -4242,6 +4242,11 @@ func (ab *AsmBuf) doasm(ctxt *obj.Link, cursym *obj.LSym, p *obj.Prog) {
AVPGATHERQD,
AVPGATHERDQ,
AVPGATHERQQ:
+ if p.GetFrom3() == nil {
+ // gathers need a 3rd arg. See issue 58822.
+ ctxt.Diag("need a third arg for gather instruction: %v", p)
+ return
+ }
// AVX512 gather requires explicit K mask.
if p.GetFrom3().Reg >= REG_K0 && p.GetFrom3().Reg <= REG_K7 {
if !avx512gatherValid(ctxt, p) {