-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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 error when building a binary with race detector enabled #64606
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
Comments
gopherbot
added
the
compiler/runtime
Issues related to the Go compiler and/or runtime.
label
Dec 7, 2023
tchung1118
changed the title
cmd/compile: compiler error when building a test binary with race detection on
cmd/compile: compiler error when building a binary with race detector enabled
Dec 7, 2023
@y1yang0 This looks like the failure is in the SCCP pass. |
Change https://go.dev/cl/548356 mentions this issue: |
ezz-no
pushed a commit
to ezz-no/go-ezzno
that referenced
this issue
Feb 18, 2024
We can't delete all the outgoing edges and then add one back in, because then we've lost the argument of any phi at the target. Instead, move the important target to the front of the list and delete the rest. This normally isn't a problem, because there is never normally a phi at the target of a jump table. But this isn't quite true when in race build mode, because there is a phi of the result of a bunch of raceread calls. The reason this happens is that each case is written like this (where e is the runtime.eface we're switching on): if e.type == $type.int32 { m = raceread(e.data, m1) } m2 = phi(m1, m) if e.type == $type.int32 { .. do case .. goto blah } so that if e.type is not $type.int32, it falls through to the default case. This default case will have a memory phi for all the (jumped around and not actually called) raceread calls. If we instead did it like if e.type == $type.int32 { raceread(e.data) .. do case .. goto blah } That would paper over this bug, as it is the only way to construct a jump table whose target is a block with a phi in it. (Yet.) But we'll fix the underlying bug in this CL. Maybe we can do the rewrite mentioned above later. (It is an optimization for -race mode, which isn't particularly important.) Fixes golang#64606 Change-Id: I6f6e3c90eb1e2638112920ee2e5b6581cef04ea4 Reviewed-on: https://go-review.googlesource.com/c/go/+/548356 Reviewed-by: Keith Randall <[email protected]> Reviewed-by: David Chase <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Go version
go version devel go1.22-bb34112d4d Thu Dec 7 17:27:54 2023 +0000 darwin/arm64
What operating system and processor architecture are you using (
go env
)?What did you do?
I have the following code:
main.go
:And I tried to build it with the following command:
What did you expect to see?
I expect the compilation to succeed. (succeeds in go1.21)
What did you see instead?
I see an internal compiler error with the following trace:
The text was updated successfully, but these errors were encountered: