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/internal/obj/s390x: panic on assembling invalid FMA instruction #26700

Closed
smasher164 opened this Issue Jul 30, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@smasher164
Contributor

smasher164 commented Jul 30, 2018

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

Tested with 1.10, 1.11beta2, and master

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/akhil/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/akhil/work"
GOPROXY=""
GORACE=""
GOROOT="/Users/akhil/Projects/go"
GOTMPDIR=""
GOTOOLDIR="/Users/akhil/Projects/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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/13/_hxzb_513nv2zh71188hsczr0000gn/T/go-build504608614=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I tried to build the following files: GOOS=linux GOARCH=s390x go build

main.go

package main

func asm()

func main() {}

asm_s390x.s

#include "textflag.h"

TEXT ·asm(SB),NOSPLIT,$0
	FMADD F0, F1, F2, F3
	RET

What did you expect to see?

The following output is with master (52cc9e3)

# _/Users/akhil/testgo/s390xasm
asm: illegal combination FMADD FREG FREG FREG FREG
asm: prog: 00000 (/Users/akhil/testgo/s390xasm/asm_s390x.s:4)	FMADD	F0, F1, F2, F3

What did you see instead?

# _/Users/akhil/testgo/s390xasm
asm: illegal combination FMADD FREG FREG FREG FREG
asm: prog: 00000 (/Users/akhil/testgo/s390xasm/asm_s390x.s:4)	FMADD	F0, F1, F2, F3
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x6 pc=0x112109d]

goroutine 1 [running]:
cmd/internal/obj/s390x.(*ctxtz).asmout(0xc0000d7be8, 0xc00006f790, 0xc0000d7bd0)
	/Users/akhil/Projects/go/src/cmd/internal/obj/s390x/asmz.go:2615 +0x5d
cmd/internal/obj/s390x.spanz(0xc0000c6000, 0xc0000d0000, 0xc000040490)
	/Users/akhil/Projects/go/src/cmd/internal/obj/s390x/asmz.go:444 +0x145
cmd/internal/obj.Flushplist(0xc0000c6000, 0xc0000d7e60, 0xc000040490, 0x0, 0x0)
	/Users/akhil/Projects/go/src/cmd/internal/obj/plist.go:107 +0x6ab
main.main()
	/Users/akhil/Projects/go/src/cmd/asm/main.go:75 +0x6e9
@ianlancetaylor

This comment has been minimized.

Contributor

ianlancetaylor commented Aug 3, 2018

@ianlancetaylor ianlancetaylor added this to the Go1.12 milestone Aug 3, 2018

@gopherbot

This comment has been minimized.

gopherbot commented Dec 7, 2018

Change https://golang.org/cl/153177 mentions this issue: cmd/internal/obj/s390x: don't crash on invalid instruction

@gopherbot gopherbot closed this in e546ef1 Dec 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment