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: compiler hangs on tiny program #25006

Closed
ALTree opened this issue Apr 23, 2018 · 5 comments

Comments

Projects
None yet
4 participants
@ALTree
Copy link
Member

commented Apr 23, 2018

$ gotip version
go version devel +d11df8baa8 Sun Apr 22 22:32:11 2018 +0000 linux/amd64

The following program:

package p

func spin() {
	var i int
	var b bool

	switch 1 {
	case 0:
		i = 1
	}
	switch 1 {
	case i:
	default:
		i = 1
		b = !b && (b && !b) && b
	}
	switch false {
	case false:
		i = 3 + -i
		switch 0 {
		case 1 - i:
		}
	}
}

hangs the tip compiler (spinning at 100% cpu) when built for amd64.

It compiles in no time in go1.10.

@ALTree

This comment has been minimized.

Copy link
Member Author

commented Apr 23, 2018

The issue was introduced in CL 100935 (cmd/compile: implement CMOV on amd64).

cc @rasky @randall77

@TocarIP

This comment has been minimized.

Copy link
Contributor

commented Apr 23, 2018

Looks like an endless loop in rules application. Will send fix soon

@gopherbot

This comment has been minimized.

Copy link

commented Apr 23, 2018

Change https://golang.org/cl/108879 mentions this issue: cmd/compile/internal/ssa: fix endless compile loop on AMD64

@TocarIP

This comment has been minimized.

Copy link
Contributor

commented Apr 23, 2018

Looks like it is easy to introduce endless rewrite, maybe we should just stop rewrite after e. g. 1000*values rewrites and suggest opening a bug.

@gopherbot gopherbot closed this in fb017c6 Apr 24, 2018

@rasky

This comment has been minimized.

Copy link
Member

commented Apr 25, 2018

Thanks @TocarIP for cleaning up after me!

@golang golang locked and limited conversation to collaborators Apr 25, 2019

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