-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: wrong modulo code generation #12411
Comments
Is your bug about Go 1.4, 1.5, or the SSA branch? Your bug report mentions all of them and is not entirely clear. (edit: OP updated the original post several times now. My comment no longer seems to make sense.) |
Updated the bug to make it obvious. |
I believe SSA is the correct one here, as 0 is the correct answer. Both 1.4 and 1.5 are wrong. Notice that there is no way to get a negative number out of this expression if a4 is a small positive integer. |
Right. Do you know which version runs on playground? |
1.5. Just run the following on the playground: fmt.Println(runtime.Version()) |
With gccgo I get this from go run: f1_ssa(4) = 0, wanted -1 |
It's also broken on master. % go version
go version devel +019297a Mon Aug 31 04:42:04 2015 +0000 linux/amd64
% go run failed-913821796.go Since master, go1.4 go1.5 and master are broken I don't quiet understand why playground is correct. |
Playground is Go 1.5 linux/amd64p32 (http://play.golang.org/p/5VtpB8FPuo) |
I updated the test to reflect that go1.4 / go1.5 / master fail. |
I'd prefer if you stop modifying old comments. It makes following discussions harder. |
I have a fix for this. It will probably be just in Go 1.6, not backported to existing releases. It's been there since Go 1 so I think it's safe to leave for another few months. |
CL https://golang.org/cl/17818 mentions this issue. |
The following code behaves differently on {dev.ssa, gccgo} vs {go1.4, go1.5, master}. The expected result is to print nothing and exit with exit code 0.
dev.ssa works
go version devel +3b7f0c9 Mon Aug 31 03:07:43 2015 +0000 linux/amd64
master broken
go version devel +019297a Mon Aug 31 04:42:04 2015 +0000 linux/amd64
go1.4 broken
go version go1.4.1 linux/amd64
go1.5 broken
go version go1.5 linux/amd64
This is related to modulo. Works correctly on playground http://play.golang.org/p/rSBXghm4TM (Go 1.5 linux/amd64p32)
The text was updated successfully, but these errors were encountered: