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: unexpected dot in identifier: .anon0 #25101

Closed
mhilton opened this issue Apr 26, 2018 · 3 comments

Comments

Projects
None yet
7 participants
@mhilton
Copy link

commented Apr 26, 2018

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

go version devel +736390c2bd Thu Apr 26 07:07:18 2018 +0000 linux/amd64

Does this issue reproduce with the latest release?

No, version 1.10.1 seems fine

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mhilton/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mhilton/go"
GORACE=""
GOROOT="/home/mhilton/opt/go"
GOTMPDIR=""
GOTOOLDIR="/home/mhilton/opt/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
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"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build736391734=/tmp/go-build -gno-record-gcc-switches"

What did you do?

  1. Create the following files:

==> local/a/a.go <==

package a

import "local/a/b"

var (
	x b.X
	y = x.Y
)

==> local/a/b/b.go <==

package b

type X interface {
	Y(int)
}

==> local/a/a_test.go <==

package a

var Y = &y

run go test local/a

What did you expect to see?

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4e5e2d]

goroutine 1 [running]:
local/a.init()
	/home/mhilton/go/src/local/a/a.go:7 +0x4d
FAIL	local/a	0.003s

What did you see instead?

# local/a [local/a.test]
<autogenerated>:1: internal compiler error: unexpected dot in identifier: .anon0

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
	/home/mhilton/opt/go/src/runtime/debug/stack.go:24 +0xa7
cmd/compile/internal/gc.Fatalf(0xc13281, 0x20, 0xc0003a2fb0, 0x1, 0x1)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/subr.go:182 +0x1f7
cmd/compile/internal/gc.(*exportWriter).localIdent(0xc00034acf0, 0xc00006f500, 0x0)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/iexport.go:1383 +0x3e1
cmd/compile/internal/gc.(*exportWriter).param(0xc00034acf0, 0xc000022480)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/iexport.go:723 +0x92
cmd/compile/internal/gc.(*exportWriter).paramList(0xc00034acf0, 0xc00000c0e8, 0x1, 0x1)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/iexport.go:717 +0x5a
cmd/compile/internal/gc.(*exportWriter).signature(0xc00034acf0, 0xc00006f560)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/iexport.go:707 +0x4b
cmd/compile/internal/gc.(*exportWriter).doTyp(0xc00034acf0, 0xc00006f560)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/iexport.go:646 +0x6f0
cmd/compile/internal/gc.(*iexporter).typOff(0xc0000a4ea0, 0xc00006f560, 0x1200000000000001)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/iexport.go:597 +0xab
cmd/compile/internal/gc.(*exportWriter).typ(0xc00034ac60, 0xc00006f560)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/iexport.go:580 +0x38
cmd/compile/internal/gc.(*exportWriter).doTyp(0xc00034ac60, 0xc00006f740)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/iexport.go:622 +0x731
cmd/compile/internal/gc.(*iexporter).typOff(0xc0000a4ea0, 0xc00006f740, 0x7ffcf3c1c5fc)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/iexport.go:597 +0xab
cmd/compile/internal/gc.(*exportWriter).typ(0xc00034abd0, 0xc00006f740)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/iexport.go:580 +0x38
cmd/compile/internal/gc.(*iexporter).doDecl(0xc0000a4ea0, 0xc00038e3c0)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/iexport.go:422 +0x2ef
cmd/compile/internal/gc.iexport(0xc00035f000)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/iexport.go:276 +0x38d
cmd/compile/internal/gc.dumpexport(0xc00008ecc0)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/export.go:79 +0x8f
cmd/compile/internal/gc.dumpCompilerObj(0xc00008ecc0)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/obj.go:119 +0x39
cmd/compile/internal/gc.dumpobj1(0x7ffcf3c1c508, 0x23, 0x3)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/obj.go:70 +0x15b
cmd/compile/internal/gc.dumpobj()
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/obj.go:51 +0x60
cmd/compile/internal/gc.Main(0xc209c8)
	/home/mhilton/opt/go/src/cmd/compile/internal/gc/main.go:684 +0x299a
main.main()
	/home/mhilton/opt/go/src/cmd/compile/main.go:49 +0x96

FAIL	local/a [build failed]

@agnivade agnivade added this to the Go1.11 milestone Apr 26, 2018

@mvdan

This comment has been minimized.

Copy link
Member

commented Apr 26, 2018

This seems to be in the code added by @mdempsky for the new indexed export format, so it's probably best if he has a look.

@griesemer

This comment has been minimized.

Copy link
Contributor

commented Jun 5, 2018

Simpler. Compiling this package causes the error. The problem is a possibly overly strict check in the exported. The solution may be as simple as exporting ".anonX" named parameters as "".

package p

type T interface {
	M(int)
}

var x T
var M = x.M
@gopherbot

This comment has been minimized.

Copy link

commented Jun 5, 2018

Change https://golang.org/cl/116376 mentions this issue: cmd/compile: revert internal parameter rename (from ".anonX" to "") before export

@gopherbot gopherbot closed this in 9be4f31 Jun 5, 2018

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