cmd/compile: make check2 gracefully exit if it reported errors

Otherwise, if -d=panic was set, check2 will treat already reported
error as internal compiler error.

For #43311
Fixes #44445

Change-Id: I5dbe06334666df21d9107396b9dcfdd905aa1e44
Reviewed-on: https://go-review.googlesource.com/c/go/+/294850
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Cuong Manh Le 2021-02-21 22:27:19 +07:00
parent 1d0256a989
commit 868a110c56
4 changed files with 10 additions and 10 deletions

View file

@ -68,10 +68,10 @@ func check2(noders []*noder) {
}
pkg, err := conf.Check(base.Ctxt.Pkgpath, files, &info)
files = nil
base.ExitIfErrors()
if err != nil {
base.FatalfAt(src.NoXPos, "conf.Check error: %v", err)
}
base.ExitIfErrors()
if base.Flag.G < 2 {
os.Exit(0)
}