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: "ICE: 'main': schedule does not include all values in block b19 crash" for Go1.12 and Go1.13 but fixed in Go1.14 #37246

Closed
amarjeetanandsingh opened this issue Feb 16, 2020 · 4 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.

Comments

@amarjeetanandsingh
Copy link
Contributor

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

$ go version
go version go1.13.4 darwin/amd64

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/amarjeet.anand/Library/Caches/go-build"
GOENV="/Users/amarjeet.anand/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/amarjeet.anand/go/"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.13.4/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/51/451rh2r11ms9t3v8r41m3240m4hm72/T/go-build510712061=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

A program to reproduce the error.
https://play.golang.org/p/mHJcF72uF9J

What did you see instead?

It gives error as below :-

# command-line-arguments
./3.go:11:23: internal compiler error: 'main': schedule does not include all values in block b19

Please file a bug report including a short program that triggers the error.
https://golang.org/issue/new
@mark-rushakoff
Copy link
Contributor

It looks like go 1.12 hits the same internal compiler error as go 1.13, but with go version devel +3eab754cd0 Thu Feb 13 19:49:45 2020 +0000 darwin/amd64, the program compiles and runs successfully.

@odeke-em
Copy link
Member

Thank you for the report @amarjeetanandsingh and welcome to the Go project! Thank you @mark-rushakoff for the initial investigation.

Indeed, as @mark-rushakoff confirmed, the problem starts with Go1.12 and from my investigation, it seems to have been caused by f062f48 aka CL 165858 (/cc @randall77 @dr2chase) in the short circuiting logic. It then seems to have been fixed by @josharian's 52ae04f aka CL 178197 for Go1.14 aka Go tip so it is already fixed. @amarjeetanandsingh, in the meantime please use Go1.14beta1
https://golang.org/dl/#unstable

go get golang.org/dl/go1.14rc1

Perhaps we might need some backports?

@odeke-em odeke-em changed the title internal compiler error: 'main': schedule does not include all values in block b19 cmd/compile: "ICE: 'main': schedule does not include all values in block b19 crash" for Go1.12 and Go1.13 but fixed in Go1.14 Feb 16, 2020
@odeke-em odeke-em added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Feb 16, 2020
@josharian
Copy link
Contributor

I don't know for sure, but it seems likely to me that CL 178197 might have fixed this particular incident, but that there may yet be similar cases lurking. We should look to see whether there's an independent fix, not least because we shouldn't backport CL 178197.

I'm out of time for the moment, but here's a partially minimized reproduction:

package main

func main() {
	var n, a, b int64
	for i := int64(2); i < 10; i++ {
		for j := i; j < 10; j++ {
			if ((n % (i * j)) == 0) && (j > 1 && (n/(i*j)) == 1) {
				a, b = i, 0
				a = n / (i * j)
			}
		}
	}

	if a != b && a != n {
		println("YES")
	}
}

From my first look, it appears that the problem is with CSEing a Select0. When CSE moves a tuple generator to a new block it is supposed to move all selectors along with it. It did so, but somehow there was still a phi value using the old selector as an arg. The old selector thus doesn't get deadcoded, causing scheduling to fail.

That's as far as I've gotten, and as far as I'm likely to get in the very near term.

cc @cherrymui @randall77

@gopherbot
Copy link

Change https://golang.org/cl/233941 mentions this issue: cmd/compile: add test for issue 37246

@golang golang locked and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

5 participants