Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/asm: panic on wrong AVX512 assembly #58822

Closed
wojciech-sneller opened this issue Mar 2, 2023 · 1 comment
Closed

cmd/asm: panic on wrong AVX512 assembly #58822

wojciech-sneller opened this issue Mar 2, 2023 · 1 comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@wojciech-sneller
Copy link

wojciech-sneller commented Mar 2, 2023

What version of Go are you using (go version)?

$ go version
go version go1.20 linux/amd64

Does this issue reproduce with the latest release?

Don' know

What did you do?

I tried to compile a program having a mistake in asm code:

~/tmp/bug$ cat go.mod 
module main
~/tmp/bug$ cat main.go 
package main

// go:noescape
// go:nosplit
func procedure()

func main() {
    procedure()
}
~/tmp/bug$ cat proc_amd64.s 
#include "textflag.h"
#include "funcdata.h"
#include "go_asm.h"

TEXT ·procedure(SB), NOSPLIT|NOFRAME, $0-8
    VPGATHERDD (BX)(Z0*1), Z2 # missing the second argument (an kreg)

    RET

What did you expect to see?

An error message, like that:

asm: "".procedure: invalid instruction: 00000 (/home/wojtek/tmp/bug/proc_amd64.s:6)	VPADDD	Z2, Z0

What did you see instead?

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x56df73]

goroutine 1 [running]:
cmd/internal/obj/x86.(*AsmBuf).doasm(0xc000111b70, 0xc000104400, 0xc000106180, 0xc00017c0d0)
	/usr/local/go/src/cmd/internal/obj/x86/asm6.go:4245 +0x193
cmd/internal/obj/x86.(*AsmBuf).asmins(0xc000111b70, 0xc000104400, 0xc000106180, 0xc00017c0d0)
	/usr/local/go/src/cmd/internal/obj/x86/asm6.go:5377 +0x46
cmd/internal/obj/x86.span6(0xc000104400, 0xc000106180, 0xc0000522f0?)
	/usr/local/go/src/cmd/internal/obj/x86/asm6.go:2156 +0x991
cmd/internal/obj.Flushplist(0xc000104400, 0xc000111e60, 0x0, {0x7ffe4db85038, 0x4})
	/usr/local/go/src/cmd/internal/obj/plist.go:152 +0x88d
main.main()
	/usr/local/go/src/cmd/asm/main.go:96 +0x6f7
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Mar 2, 2023
@gopherbot
Copy link

Change https://go.dev/cl/472795 mentions this issue: cmd/asm: don't panic on bad GATHER x86 instructions

@dmitshur dmitshur added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 2, 2023
@dmitshur dmitshur added this to the Go1.21 milestone Mar 2, 2023
@golang golang locked and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants