Skip to content

gccgo: unneeded hash/equal functions emitted for runtime types #19773

Open
@thanm

Description

@thanm

Please answer these questions before submitting your issue. Thanks!

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

gccgo trunk/tip
go version devel +7e817859b3 Mon Mar 27 18:51:42 2017 +0000 linux/amd64

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

GOARCH="amd64"
GOOS="linux"

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

https://play.golang.org/p/tl4iNxoar6

What did you expect to see?

This program compiles and builds with gccgo, however I note that the compiler is generating more hash/equal functions that it needs to. In particular, it seems to have decided that it should generate hash/equal functions for the anonymous type corresponding to the BySize field in runtime.MemStats, along with a few other runtime types. This is not a bad thing from a correctness point of view, but it results in extra wasted work at compile time and link time, as well as object file bloat.

What did you see instead?

I would expect that the compiler would be able to recognize that the type in question is in an external package and that the hash/equal functions can be picked up externally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions