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: missing import reader for sync.(*RWMutex).RLock #48454

Closed
dominikh opened this issue Sep 18, 2021 · 2 comments
Closed
Assignees
Milestone

Comments

@dominikh
Copy link
Member

@dominikh dominikh commented Sep 18, 2021

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

$ go version
go version devel go1.18-4b654c0eec Fri Sep 17 23:44:10 2021 +0000 linux/amd64

What did you do?

mkdir scratch
cd scratch
curl https://play.golang.org/p/cbBJKQG16i4.go | txtar -x
go build ./cmd/demo

Note that the bug only reproduces when building ./cmd/demo. It does not trigger when building either the top-level package or the container package.

What did you see instead?

# honnef.co/go/bittorrent/cmd/demo
/tmp/bar/container/container.go:10:15: internal compiler error: missing import reader for sync.(*RWMutex).RLock

goroutine 1 [running]:
runtime/debug.Stack()
	/home/dominikh/prj/go/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0xd5d71fff, 0x7f6a}, {0xceae44, 0x1c}, {0xc00058d3c0, 0x1, 0x1})
	/home/dominikh/prj/go/src/cmd/compile/internal/base/print.go:227 +0x154
cmd/compile/internal/base.Fatalf(...)
	/home/dominikh/prj/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/typecheck.ImportBody(0xc00011e9a0)
	/home/dominikh/prj/go/src/cmd/compile/internal/typecheck/iimport.go:73 +0x1b9
cmd/compile/internal/typecheck.ImportedBody(0xc00011e9a0)
	/home/dominikh/prj/go/src/cmd/compile/internal/typecheck/func.go:169 +0xad
cmd/compile/internal/inline.oldInline(0xc0001457a0, 0xc00011e9a0, 0x0)
	/home/dominikh/prj/go/src/cmd/compile/internal/inline/inl.go:785 +0x53
cmd/compile/internal/inline.mkinlcall(0xc0001457a0, 0xc00011e9a0, 0x5b6402, 0xc000115590, 0xc000128fa0)
	/home/dominikh/prj/go/src/cmd/compile/internal/inline/inl.go:737 +0xc85
cmd/compile/internal/inline.inlnode({0xe482f8, 0xc0001457a0}, 0x20, 0x30, 0x7f6afc6a35b8)
	/home/dominikh/prj/go/src/cmd/compile/internal/inline/inl.go:594 +0x4e5
cmd/compile/internal/inline.InlineCalls.func1({0xe482f8, 0xc0001457a0})
	/home/dominikh/prj/go/src/cmd/compile/internal/inline/inl.go:513 +0x31
cmd/compile/internal/ir.editNodes({0xc00011c4c0, 0x1, 0x203000}, 0xc000128fa0)
	/home/dominikh/prj/go/src/cmd/compile/internal/ir/node_gen.go:1521 +0x74
cmd/compile/internal/ir.(*Func).editChildren(0xc00058dad8, 0x5b9607)
	/home/dominikh/prj/go/src/cmd/compile/internal/ir/func.go:153 +0x2e
cmd/compile/internal/ir.EditChildren(...)
	/home/dominikh/prj/go/src/cmd/compile/internal/ir/visit.go:185
cmd/compile/internal/inline.InlineCalls(0xc00011f340)
	/home/dominikh/prj/go/src/cmd/compile/internal/inline/inl.go:515 +0xf2
cmd/compile/internal/inline.InlinePackage.func1({0xc000118340, 0x1, 0xc00011f340}, 0x0)
	/home/dominikh/prj/go/src/cmd/compile/internal/inline/inl.go:71 +0x46
cmd/compile/internal/ir.(*bottomUpVisitor).visit(0xc000115470, 0xc00011f340)
	/home/dominikh/prj/go/src/cmd/compile/internal/ir/scc.go:127 +0x2f0
cmd/compile/internal/ir.VisitFuncsBottomUp({0xc00012aac0, 0x4, 0xb}, 0xd07570)
	/home/dominikh/prj/go/src/cmd/compile/internal/ir/scc.go:60 +0x105
cmd/compile/internal/inline.InlinePackage()
	/home/dominikh/prj/go/src/cmd/compile/internal/inline/inl.go:58 +0x33
cmd/compile/internal/gc.Main(0xd07420)
	/home/dominikh/prj/go/src/cmd/compile/internal/gc/main.go:246 +0xc7d
main.main()
	/home/dominikh/prj/go/src/cmd/compile/main.go:55 +0xdd
@dominikh
Copy link
Member Author

@dominikh dominikh commented Sep 18, 2021

Bisects to

commit 80783558b06741beaf41dbd198013fe3a13c9ad2
Author: Dan Scales <danscales@google.com>
Date:   Mon Sep 6 16:25:43 2021 -0700

    cmd/compile: make sure imported instantiated types have their methods created
    
    We should be putting a newly instantiated imported type in
    Instantiate/doInst onto the instTypeList, so its methods/dictionaries
    are instantiated. To do this, we needed a more general way to add a
    type to instTypeList, so add NeedInstType(), analogous to
    NeedRuntimeType(). This has the extra advantage that now all types
    created by the type substituter are added to instTypeList without any
    extra code, which was easy to forget. doInst() now correctly calls
    NeedInstType().
    
    This is a bit aggressive, since a fully instantiated type in a generic
    function/method may never be used, if the generic method is never
    instantiated in the local package. But it should be fairly uncommon for
    a generic method to mention a fully instantiated type (but it does
    happen in this bug).
    
    Fixes both cases mentioned in the bug.
    
    Fixed #48185

/cc @danscales

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Sep 21, 2021

Change https://golang.org/cl/351315 mentions this issue: cmd/compile: fix crawler for unexported fields with instantiated types

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants