Skip to content

cmd/compile: internal compiler error: weird package in name (dev.regabi branch) #43479

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

Closed
zikaeroh opened this issue Jan 3, 2021 · 4 comments

Comments

@zikaeroh
Copy link
Contributor

zikaeroh commented Jan 3, 2021

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

$ go version
go version devel +8fc44cf0fa Sun Jan 3 19:48:20 2021 +0000 linux/amd64

Does this issue reproduce with the latest release?

No, only on the regabi branch.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jake/.cache/go-build"
GOENV="/home/jake/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/jake/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/jake/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/jake/zikaeroh/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/jake/zikaeroh/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/jake/pkger/go.mod"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build831767264=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version devel +8fc44cf0fa Sun Jan 3 19:48:20 2021 +0000 linux/amd64
GOROOT/bin/go tool compile -V: compile version devel +8fc44cf0fa Sun Jan 3 19:48:20 2021 +0000
uname -sr: Linux 5.10.4-zen2-1-zen
/usr/lib/libc.so.6: GNU C Library (GNU libc) release release version 2.32.
gdb --version: GNU gdb (GDB) 10.1

What did you do?

Cloned https://github.com/markbates/pkger, built the dev.regabi branch, and did a go build in the pkger checkout.

What did you expect to see?

No errors, a built binary.

What did you see instead?

# github.com/markbates/pkger/here
here/here.go:14:5: internal compiler error: weird package in name: here.p => p, not ""

goroutine 1 [running]:
runtime/debug.Stack(0xe8d1a0, 0xc0000bc008, 0x0)
	/home/jake/zikaeroh/go/src/runtime/debug/stack.go:24 +0x9f
cmd/compile/internal/base.FatalfAt(0xe05000000002, 0xd6fb5c, 0x27, 0xc00008d498, 0x3, 0x3)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/base/print.go:227 +0x1b9
cmd/compile/internal/base.Fatalf(...)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/typecheck.(*exportWriter).localIdent(0xc000598de0, 0xc0003882d0, 0x0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1557 +0x234
cmd/compile/internal/typecheck.(*exportWriter).param(0xc000598de0, 0xc0003a1f40)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:754 +0x96
cmd/compile/internal/typecheck.(*exportWriter).paramList(0xc000598de0, 0xc0000bc3d8, 0x1, 0x1)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:748 +0x65
cmd/compile/internal/typecheck.(*exportWriter).signature(0xc000598de0, 0xc0003a48a0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:738 +0x7e
cmd/compile/internal/typecheck.(*exportWriter).doTyp(0xc000598de0, 0xc0003a48a0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:679 +0x7af
cmd/compile/internal/typecheck.(*iexporter).typOff(0xc0000c63c0, 0xc0003a48a0, 0xc000598d88)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:626 +0xd5
cmd/compile/internal/typecheck.(*exportWriter).typ(0xc000598d80, 0xc0003a48a0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:609 +0x38
cmd/compile/internal/typecheck.(*iexporter).doDecl(0xc0000c63c0, 0xc000377180)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:438 +0x307
cmd/compile/internal/typecheck.WriteExports(0xc0003b0c40)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:274 +0x2a6
cmd/compile/internal/gc.dumpexport(0xc00009e750)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/gc/export.go:34 +0x18c
cmd/compile/internal/gc.dumpCompilerObj(0xc00009e750)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/gc/obj.go:106 +0x39
cmd/compile/internal/gc.dumpobj1(0x7ffc29438d9c, 0x23, 0x3)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/gc/obj.go:62 +0x174
cmd/compile/internal/gc.dumpobj()
	/home/jake/zikaeroh/go/src/cmd/compile/internal/gc/obj.go:43 +0x50
cmd/compile/internal/gc.Main(0xd7ed10)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/gc/main.go:349 +0x1305
main.main()
	/home/jake/zikaeroh/go/src/cmd/compile/main.go:54 +0xb1

/cc @mdempsky

@mdempsky mdempsky self-assigned this Jan 3, 2021
@zikaeroh
Copy link
Contributor Author

zikaeroh commented Jan 3, 2021

Bisects to CL 274440 for me.

@mdempsky
Copy link
Contributor

mdempsky commented Jan 3, 2021

Thanks for the bisection.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/281292 mentions this issue: [dev.regabi] cmd/compile: fix re-export of parameters

gopherbot pushed a commit that referenced this issue Jan 4, 2021
When exporting signature types, we include the originating package,
because it's exposed via go/types's API. And as a consistency check,
we ensure that the parameter names came from that same package.

However, we were getting this wrong in the case of exported variables
that were initialized with a method value using an imported method. In
this case, when we created the method value wrapper function's
type (which is reused as the variable's type if none is explicitly
provided in the variable declaration), we were reusing the
original (i.e., imported) parameter names, but the newly created
signature type was associated with the current package instead.

The correct fix here is really to preserve the original signature
type's package (along with position and name for its parameters), but
that's awkward to do at the moment because the DeclFunc API requires
an ir representation of the function signature, whereas we only
provide a way to explicitly set packages via the type constructor
APIs.

As an interim fix, we associate the parameters with the current
package, to be consistent with the signature type's package.

Fixes #43479.

Change-Id: Id45a10f8cf64165c9bc7d9598f0a0ee199a5e752
Reviewed-on: https://go-review.googlesource.com/c/go/+/281292
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
@zikaeroh
Copy link
Contributor Author

zikaeroh commented Jan 4, 2021

Closing as fixed on dev.regabi (GitHub won't autoclose this until it's merged into master).

@zikaeroh zikaeroh closed this as completed Jan 4, 2021
@golang golang locked and limited conversation to collaborators Jan 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants