golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.74k stars 17.63k forks source link

cmd/go: gccgo crashes when building json-iterator #37288

Open paleozogt opened 4 years ago

paleozogt commented 4 years ago

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

$ go version
go version go1.12.2 gccgo (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008 linux/amd64

$ powerpc64le-linux-gnu-gccgo-9 --version
powerpc64le-linux-gnu-gccgo-9 (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Does this issue reproduce with the latest release?

I'm using gccgo-9, which I think is the latest.

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

go env Output
$ go env
GOARCH="ppc64le"
GOBIN=""
GOCACHE="/home/apollo/.gocache"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/apollo/Development/json-iterator"
GOPROXY=""
GORACE=""
GOROOT="/usr"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/gcc/x86_64-linux-gnu/9"
GCCGO="/usr/bin/powerpc64le-linux-gnu-gccgo-9"
CC="powerpc64le-linux-gnu-gcc-9"
CXX="x86_64-linux-gnu-g++-9"
CGO_ENABLED="0"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build273883847=/tmp/go-build -gno-record-gcc-switches -funwind-tables"

What did you do?

export GOARCH=ppc64le
export CC=powerpc64le-linux-gnu-gcc-9
go get -v github.com/json-iterator/go

What did you expect to see?

Successful installation of the module.

What did you see instead?

gccgo crashes:

github.com/json-iterator/go
# github.com/json-iterator/go
go1: internal compiler error: in do_get_backend, at go/gofrontend/expressions.cc:4677
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.
paleozogt commented 4 years ago

Trying with different gccgo cross-compilers...

amd64 works:

export GOARCH=amd64 
export CC=x86_64-linux-gnu-gcc-9
go get -v github.com/json-iterator/go
file pkg/gccgo_linux_amd64/github.com/json-iterator/libgo.a
pkg/gccgo_linux_amd64/github.com/json-iterator/libgo.a: current ar archive

arm64 works:

export GOARCH=arm64
export CC=aarch64-linux-gnu-gcc-9
go get -v github.com/json-iterator/go
file pkg/gccgo_linux_arm64/github.com/json-iterator/libgo.a
pkg/gccgo_linux_arm64/github.com/json-iterator/libgo.a: current ar archive

ppc works:

export GOARCH=ppc
export CC=powerpc-linux-gnu-gcc-9
go get -v github.com/json-iterator/go
file pkg/gccgo_linux_ppc/github.com/json-iterator/libgo.a
pkg/gccgo_linux_ppc/github.com/json-iterator/libgo.a: current ar archive

ppc64 crashes:

export GOARCH=ppc64
export CC=powerpc64-linux-gnu-gcc-9
go get -v github.com/json-iterator/go
github.com/modern-go/concurrent
github.com/modern-go/reflect2
github.com/json-iterator/go
# github.com/json-iterator/go
go1: internal compiler error: in do_get_backend, at go/gofrontend/expressions.cc:4677
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.
paleozogt commented 4 years ago

btw, the crash says to look at /usr/share/doc/gcc-9/README.Bugs, but it doesn't exist:

cat /usr/share/doc/gcc-9/README.Bugs
cat: /usr/share/doc/gcc-9/README.Bugs: No such file or directory
toothrot commented 4 years ago

/cc @ianlancetaylor