-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: miscompilation in star-tex.org/x/cmd/star-tex #59432
Comments
CC @golang/compiler |
Does the test pass with an older version of Go (which is known to work) with |
yes, with 581603c (Go1.18.10) and 7ffc1e4 (one revision before 1c783f7), I get:
|
interestingly, with today's
(ie: it's the same for 1c783f7 (the first "bad" revision):
|
Can confirm that undoing that single CL "fixes" the bug. As they say, hmmmmmmm. |
I wasn't able to write a test case, so shall include the debugging debris here:
compiles to (just before late lower)
late lower transforms this to
After additional optimization, v879 is moved to another block, and its input (v1953) is spilled as a byte:
and the root cause of this is the wrong type used to create the optimized LEA instructions. |
Change https://go.dev/cl/482536 mentions this issue: |
@gopherbot please open the backport tracking issues. This is a severe compiler bug. |
Backport issue(s) opened: #59467 (for 1.19), #59468 (for 1.20). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
Change https://go.dev/cl/482815 mentions this issue: |
Fix CL had a problem, going to just remove the offending rewrite rules instead. |
Change https://go.dev/cl/482820 mentions this issue: |
Change https://go.dev/cl/482164 mentions this issue: |
CL 440035 added rewrite rules to simplify "costly" LEA instructions, but the types in the rewrites were wrong and the code would go bad if the wrong-typed register was spilled. CL 482536 attempted to fix this by correcting the type in the rewrite, but that "fix" broke something on windows-amd64-race. Instead / for-now, remove the offending rewrite rules. Updates #21735. Updates #59432. Fixes #59468. Change-Id: I0497c42db414f2055e1378e0a53e2bceee9cd5d9 Reviewed-on: https://go-review.googlesource.com/c/go/+/482820 Run-TryBot: David Chase <[email protected]> Reviewed-by: Cherry Mui <[email protected]> TryBot-Result: Gopher Robot <[email protected]> (cherry picked from commit 6a97a60) Reviewed-on: https://go-review.googlesource.com/c/go/+/482164 Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Keith Randall <[email protected]>
CL 440035 added rewrite rules to simplify "costly" LEA instructions, but the types in the rewrites were wrong and the code would go bad if the wrong-typed register was spilled. CL 482536 attempted to fix this by correcting the type in the rewrite, but that "fix" broke something on windows-amd64-race. Instead / for-now, remove the offending rewrite rules. Updates golang#21735. Updates golang#59432. Fixes golang#59468. Change-Id: I0497c42db414f2055e1378e0a53e2bceee9cd5d9 Reviewed-on: https://go-review.googlesource.com/c/go/+/482820 Run-TryBot: David Chase <[email protected]> Reviewed-by: Cherry Mui <[email protected]> TryBot-Result: Gopher Robot <[email protected]> (cherry picked from commit 6a97a60) Reviewed-on: https://go-review.googlesource.com/c/go/+/482164 Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Keith Randall <[email protected]>
CL 440035 added rewrite rules to simplify "costly" LEA instructions, but the types in the rewrites were wrong and the code would go bad if the wrong-typed register was spilled. CL 482536 attempted to fix this by correcting the type in the rewrite, but that "fix" broke something on windows-amd64-race. Instead / for-now, remove the offending rewrite rules. Updates golang#21735. Updates golang#59432. Fixes golang#59468. Change-Id: I0497c42db414f2055e1378e0a53e2bceee9cd5d9 Reviewed-on: https://go-review.googlesource.com/c/go/+/482820 Run-TryBot: David Chase <[email protected]> Reviewed-by: Cherry Mui <[email protected]> TryBot-Result: Gopher Robot <[email protected]> (cherry picked from commit 6a97a60) Reviewed-on: https://go-review.googlesource.com/c/go/+/482164 Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Keith Randall <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
since 1c783f7, star-tex test is failing:
ie: it was working with Go-1.18.x, but not anymore starting with Go-1.19.x.
What did you expect to see?
a sucessfully working test.
What did you see instead?
a failing test.
bisecting Go, I've found out the first revision of
go test
that triggered the failing test.star-tex is relying on web2go to automatically transpile Donald Knuth's WEB
tex.web
file to Go.the result is under
x/tex/internal/xtex
.it's machine generated so, not super easy on the eye:
the failure is actually coming from:
which, of course, shouldn't happen by just recompiling the same piece of code but with different
go build
versions.looking at 1c783f7 CL, a possible hint at the root cause generating this issue might be in how some of the C-trickeries performed in
tex.web
are translated into Go, meaning"unsafe"
:(perhaps the interplay of
unsafe.Pointer
anduintptr
atL145
andL149
?)The text was updated successfully, but these errors were encountered: