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/compile: invalid instruction TESTQ $-281474976645121, CX #19555

Closed
navytux opened this issue Mar 15, 2017 · 5 comments

Comments

Projects
None yet
3 participants
@navytux
Copy link
Contributor

commented Mar 15, 2017

Please answer these questions before submitting your issue. Thanks!

What did you do?

Hello up there, please consider the following relatively-minimal snippet:

package xxx

type NodeLink struct {}

// A role our end of NodeLink is intended to play
type LinkRole int
const (
        LinkServer LinkRole = iota      // link created as server
        LinkClient                      // link created as client

        // for testing:
        linkNoRecvSend LinkRole = 1<<16 // do not spawn serveRecv & serveSend
        linkFlagsMask  LinkRole = (1<<32 - 1) << 16
)

func NewNodeLink(role LinkRole) *NodeLink {
        var nextConnId uint32
        switch role&^linkFlagsMask {
        case LinkServer:
                nextConnId = 0  // all initiated by us connId will be even
        case LinkClient:
                nextConnId = 1  // ----//---- odd
        default:
                panic("invalid conn role")
        }

        _ = nextConnId
        return nil
}

(https://play.golang.org/p/QJn8WazIMx)

What did you expect to see?

This code compiles ok.

What did you see instead?

kirr@deco:~/tmp/trashme/t/testq$ go tool compile connection.go 
connection.go:24:8: invalid instruction: 00047 (connection.go:19)       TESTQ   $-281474976645121, CX

Does this issue reproduce with the latest release (go1.8)?

No, it is a regression:

kirr@deco:~/tmp/trashme/t/testq$ go18 tool compile connection.go 
kirr@deco:~/tmp/trashme/t/testq$ echo $?
0

System details

go version devel +43afcb5c96 Wed Mar 15 04:27:49 2017 +0000 linux/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/kirr/go"
GORACE=""
GOROOT="/home/kirr/src/tools/go/go"
GOTOOLDIR="/home/kirr/src/tools/go/go/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build190602604=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOROOT/bin/go version: go version devel +43afcb5c96 Wed Mar 15 04:27:49 2017 +0000 linux/amd64
GOROOT/bin/go tool compile -V: compile version devel +43afcb5c96 Wed Mar 15 04:27:49 2017 +0000 X:framepointer
uname -sr: Linux 4.9.0-2-amd64
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.0 (stretch)
Release:	9.0
Codename:	stretch
/lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Debian GLIBC 2.24-9) stable release version 2.24, by Roland McGrath et al.
gdb --version: GNU gdb (Debian 7.12-6) 7.12.0.20161007-git

Thanks beforehand,
Kirill

/cc @rasky

@navytux

This comment has been minimized.

Copy link
Contributor Author

commented Mar 15, 2017

@josharian

This comment has been minimized.

Copy link
Contributor

commented Mar 15, 2017

Thanks, Kirill. I'll send a fix pretty soon.

@navytux

This comment has been minimized.

Copy link
Contributor Author

commented Mar 15, 2017

Josh thanks for feedback.

@gopherbot

This comment has been minimized.

Copy link

commented Mar 15, 2017

CL https://golang.org/cl/38164 mentions this issue.

@gopherbot gopherbot closed this in 604455a Mar 15, 2017

@navytux

This comment has been minimized.

Copy link
Contributor Author

commented Mar 16, 2017

@josharian thanks for the fix.

@golang golang locked and limited conversation to collaborators Mar 16, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.