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: indexed export format needs inline bodies for map keys #26341

mdempsky opened this issue Jul 11, 2018 · 1 comment


None yet
2 participants
Copy link

commented Jul 11, 2018

We currently don't export inline bodies for map key types. I thought this was unnecessary since map indexing expressions only yield the map element type, but I forgot that range-based for loops can be used to extract the map key type.

This wasn't a problem for the old binary export format, because if an inline body was unexpectedly missing from the export data, the compiler couldn't distinguish that from it just not being inlineable. But with the indexed export format, we separately track whether a method is inlineable from whether it's (re)exported by any particular package.

$ cat a.go
package a

type k int
func (k) F() {}

type M map[k]int

$ cat b.go
package b

import "./a"

func f() {
        for k := range (a.M{}) {

$ go tool compile a.go
$ go tool compile b.go
b.go:7:6: internal compiler error: missing import reader for a.k.F

@mdempsky mdempsky added this to the Go1.11 milestone Jul 11, 2018

@mdempsky mdempsky self-assigned this Jul 11, 2018


This comment has been minimized.

Copy link

commented Jul 11, 2018

Change mentions this issue: cmd/compile: fix ICE due to missing inline function body

@gopherbot gopherbot closed this in cc422e6 Jul 12, 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.