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: internal compiler error: '(*client).sendMsgToGateways': no register available for v418 = LoweredAtomicAdd32Variant <uint32,mem> v344 v145 v407 #33355

Closed
eclipseo opened this issue Jul 29, 2019 · 8 comments
Assignees
Milestone

Comments

@eclipseo
Copy link

@eclipseo eclipseo commented Jul 29, 2019

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

Specifically Go 1.13 beta1

Does this issue reproduce with the latest release?

Yes.

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

Only on Aarch64 on Fedora Rawhide.

What did you do?

Trying to build github.com/nats-io/gnatsd 2.0.0-RC8

What did you expect to see?

Build successful

What did you see instead?

BUILDSTDERR: cd /builddir/build/BUILD/nats-server-2.0.0-RC8/_build/src/github.com/nats-io/gnatsd/server
BUILDSTDERR: /usr/lib/golang/pkg/tool/linux_arm64/compile -o $WORK/b033/_pkg_.a -trimpath "$WORK/b033=>" -shared -p github.com/nats-io/gnatsd/server -complete -installsuffix shared -buildid 9lWsjnhecOJeLDa8YX6b/9lWsjnhecOJeLDa8YX6b -goversion go1.13beta1 -D "" -importcfg $WORK/b033/importcfg -pack ./accounts.go ./auth.go ./ciphersuites.go ./client.go ./const.go ./errors.go ./events.go ./gateway.go ./jwt.go ./leafnode.go ./log.go ./monitor.go ./monitor_sort_opts.go ./nkey.go ./opts.go ./parser.go ./reload.go ./ring.go ./route.go ./server.go ./service.go ./signal.go ./sublist.go ./util.go
BUILDSTDERR: # github.com/nats-io/gnatsd/server
BUILDSTDERR: _build/src/github.com/nats-io/gnatsd/server/gateway.go:2119:10: internal compiler error: '(*client).sendMsgToGateways': no register available for v418 = LoweredAtomicAdd32Variant <uint32,mem> v344 v145 v407
BUILDSTDERR: Please file a bug report including a short program that triggers the error.
BUILDSTDERR: https://golang.org/issue/new
@julieqiu

This comment has been minimized.

Copy link

@julieqiu julieqiu commented Jul 29, 2019

Would you be able to provide more information on what you ran and why you expected to see that output?

@eclipseo

This comment has been minimized.

Copy link
Author

@eclipseo eclipseo commented Jul 29, 2019

I'm building github.com/nats-io/gnatsd 2.0.0-RC8 with:

go build -buildmode pie -compiler gc '-tags=rpm_crashtraceback ' -ldflags '-X github.com/nats-io/gnatsd/version.tag=v2.0.0-RC8 -X github.com/nats-io/gnatsd/version=2.0.0 -B 0x51f0a6c96fb7745750f72bd94ce56793deb3d943 -extldflags '\''-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '\''' -a -v -x -o /builddir/build/BUILD/nats-server-2.0.0-RC8/_build/bin/gnatsd github.com/nats-io/gnatsd

Build progress until it hits this error:

cd /builddir/build/BUILD/nats-server-2.0.0-RC8/_build/src/github.com/nats-io/gnatsd/server
BUILDSTDERR: /usr/lib/golang/pkg/tool/linux_arm64/compile -o $WORK/b033/_pkg_.a -trimpath "$WORK/b033=>" -shared -p github.com/nats-io/gnatsd/server -complete -installsuffix shared -buildid 9lWsjnhecOJeLDa8YX6b/9lWsjnhecOJeLDa8YX6b -goversion go1.13beta1 -D "" -importcfg $WORK/b033/importcfg -pack ./accounts.go ./auth.go ./ciphersuites.go ./client.go ./const.go ./errors.go ./events.go ./gateway.go ./jwt.go ./leafnode.go ./log.go ./monitor.go ./monitor_sort_opts.go ./nkey.go ./opts.go ./parser.go ./reload.go ./ring.go ./route.go ./server.go ./service.go ./signal.go ./sublist.go ./util.go
BUILDSTDERR: # github.com/nats-io/gnatsd/server
BUILDSTDERR: _build/src/github.com/nats-io/gnatsd/server/gateway.go:2119:10: internal compiler error: '(*client).sendMsgToGateways': no register available for v418 = LoweredAtomicAdd32Variant <uint32,mem> v344 v145 v407
BUILDSTDERR: Please file a bug report including a short program that triggers the error.
BUILDSTDERR: https://golang.org/issue/new

Build was working with Golang 1.12.7 under the same conditions. Other arches beside aarch64 are working correctly.

Here is a full log with latest version 2.0.2: https://kojipkgs.fedoraproject.org//work/tasks/9933/36659933/build.log

@ianlancetaylor ianlancetaylor changed the title Go 1.13: internal compiler error: '(*client).sendMsgToGateways': no register available for v418 = LoweredAtomicAdd32Variant <uint32,mem> v344 v145 v407 cmd/compile: internal compiler error: '(*client).sendMsgToGateways': no register available for v418 = LoweredAtomicAdd32Variant <uint32,mem> v344 v145 v407 Jul 29, 2019
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jul 29, 2019

@jcajka

This comment has been minimized.

Copy link
Contributor

@jcajka jcajka commented Jul 30, 2019

For the record affects master and go1.13 branch.
With latest master branch on aarch64(apm-mustang).

go version 
devel +fbb819ebc4 Tue Jul 30 02:52:57 2019 +0000 linux/arm64
go get github.com/nats-io/gnatsd
# github.com/nats-io/nats-server/server
go/src/github.com/nats-io/nats-server/server/gateway.go:2229:10: internal compiler error: '(*client).sendMsgToGateways': no register available for v426 = LoweredAtomicAdd32Variant <uint32,mem> v352 v145 v415

goroutine 6 [running]:
runtime/debug.Stack(0xabd500, 0x40000ae008, 0x0)
	/home/jcajka/golang/src/runtime/debug/stack.go:24 +0x88
cmd/compile/internal/gc.Fatalf(0x400246f8f0, 0x22, 0x400090c840, 0x2, 0x2)
	/home/jcajka/golang/src/cmd/compile/internal/gc/subr.go:188 +0x280
cmd/compile/internal/gc.(*ssafn).Fatalf(0x400513c960, 0x3000000000774, 0x917c90, 0x1c, 0x400046b220, 0x1, 0x1)
	/home/jcajka/golang/src/cmd/compile/internal/gc/ssa.go:6159 +0x150
cmd/compile/internal/ssa.(*Func).Fatalf(...)
	/home/jcajka/golang/src/cmd/compile/internal/ssa/func.go:617
cmd/compile/internal/ssa.(*regAllocState).allocReg(0x4005172a80, 0x0, 0x4001f4da60, 0x78200000001)
	/home/jcajka/golang/src/cmd/compile/internal/ssa/regalloc.go:376 +0x508
cmd/compile/internal/ssa.(*regAllocState).regalloc(0x4005172a80, 0x4002ccd080)
	/home/jcajka/golang/src/cmd/compile/internal/ssa/regalloc.go:1461 +0x193c
cmd/compile/internal/ssa.regalloc(0x4002ccd080)
	/home/jcajka/golang/src/cmd/compile/internal/ssa/regalloc.go:146 +0x58
cmd/compile/internal/ssa.Compile(0x4002ccd080)
	/home/jcajka/golang/src/cmd/compile/internal/ssa/compile.go:92 +0x81c
cmd/compile/internal/gc.buildssa(0x4000da86e0, 0x0, 0x0)
	/home/jcajka/golang/src/cmd/compile/internal/gc/ssa.go:289 +0xb18
cmd/compile/internal/gc.compileSSA(0x4000da86e0, 0x0)
	/home/jcajka/golang/src/cmd/compile/internal/gc/pgen.go:298 +0x38
cmd/compile/internal/gc.compileFunctions.func2(0x4003453380, 0x4002403b90, 0x0)
	/home/jcajka/golang/src/cmd/compile/internal/gc/pgen.go:363 +0x3c
created by cmd/compile/internal/gc.compileFunctions
	/home/jcajka/golang/src/cmd/compile/internal/gc/pgen.go:361 +0x138

As time will allow, I will look in to more reduced reproducer than the whole github.com/nats-io/nats-server package.

@jcajka

This comment has been minimized.

Copy link
Contributor

@jcajka jcajka commented Jul 30, 2019

Playing bit with the compile invocation, disabling in-lining(-gcflags="-l") seems to workaround the issue.

@randall77

This comment has been minimized.

Copy link
Contributor

@randall77 randall77 commented Jul 30, 2019

Repro:

mkdir issue33355
cd issue33355
git clone https://github.com/nats-io/gnatsd
cd gnatsd
GOARCH=arm64 go build
@randall77 randall77 self-assigned this Jul 30, 2019
@randall77

This comment has been minimized.

Copy link
Contributor

@randall77 randall77 commented Jul 30, 2019

Fix is easy, test is harder. I'm working on it.
Looks like a bad interaction in regalloc with resultNotInArgs and register avoidance optimizations. We turn out trying to avoid all registers :(

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jul 30, 2019

Change https://golang.org/cl/188178 mentions this issue: cmd/compile: don't eliminate all registers when restricting to desired ones

@gopherbot gopherbot closed this in 8a317eb Aug 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.