Skip to content

cmd/compile: obscure initialization loop error message due to inlining #21750

Open
@dvyukov

Description

@dvyukov

go version devel +0a4913b2d4 Wed Aug 23 11:09:11 2017 +0200 linux/amd64

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

Produces obscure:

tmp/sandbox278346721/main.go:3:5: initialization loop:
	prog.go:3:5 A refers to
	prog.go:3:5 A

If compiled with -l produces understandable error message:

/tmp/test.go:3:5: initialization loop:
	/tmp/test.go:3:5 A refers to
	/tmp/test.go:7:10 B refers to
	/tmp/test.go:11:10 C refers to
	/tmp/test.go:15:10 D refers to
	/tmp/test.go:3:5 A

In real scenario this is spread across files and intermixed with other code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    Status

    Triage Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions