-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: -ssa=0 generates incorrect code for append(s,s) #17039
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
Comments
If we delete the old backend, this problem is solved. Considering that SSA is the default for amd64 in Go 1.7 and we don't do point releases for fixes two versions back (for Go 1.6), there's nothing to do here unless we also generate bad code for non-amd64 architectures. Want to add a test/fixedbugs/nnnnn.go file with this case and run it against the trybots and see? You'll need to make your git commit's parent be before tip's SSA starting being enabled by default for various architectures. I'd add the test on the release-go1.7 branch and trybot that. |
Agreed that deleting the old backend is a solution and that go1.6 is a dead letter; my concern was about current non-x86. I'll add the suggested test. |
At 1.7, the test fails on a bunch of platforms: https://go-review.googlesource.com/c/28873/ |
Well, fails on |
Flagging this potentially for 1.7.2. Not sure whether it bites people in practice. |
This doesn't seem like something that would occur in practice. Can you actually do anything with such a recursive type? My brain hurts trying to type check it. |
Agree. |
I agree this example is just a toy, but if the cause is a bug in the register allocator, the problem might be more general. |
I think the bug is triggered when the slice you're appending to and the thing you're appending are in the same register. That doesn't ever happen in practice - they always have different types. |
The problem only occurs with this peculiar, rare form of statement, so it won't get fixed in a point release, and the old backend is now gone. Closing. |
gc 1.6.2 generates incorrect linux/amd64 code for the following program: the final print statement prints the wrong answer.
From the assembly, it appears that the register r8, which holds the old value of s.ptr and is used in the s[0]==nil check, gets set to the the new value of s.ptr during the growslice operation.
By default, the tip gc generates completely different code that does not exhibit the problem, but with
-ssa=0
the same problem reoccurs (with r9). See comments in listing below.The text was updated successfully, but these errors were encountered: