-
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: bug in string comparison #24817
Comments
It's still broken at head ( |
Oddly, it is not a commutative bug. If the empty string is on the RHS then it is fine (https://play.golang.org/p/TULS3BC_uuY). |
Interesting regression from Go1.8. Root cause: https://golang.org/cl/26758 \cc @josharian @bradfitz |
Nice find! On my phone, but I believe the offending line is:
Unlike = and !=, the order of args here matters for > and <. Oops. This only happens for the empty string. The cleanest fix is probably to rewrite >, <, >=, and <= for “” into !=, false, true, and == respectively. I’ll send a CL first chance I get. |
Ouch. This will need some backports too. |
Change https://golang.org/cl/106655 mentions this issue: |
For the record, the affected comparisons are: "" < s
"" <= s
"" > s
"" >= s |
Reopening for backport. |
@josharian can you open another issue on the 1.9.6 milestone per https://golang.org/wiki/MinorReleases? (This process is new and will be communicated more widely very soon) |
We keep going back and forth on this. So now we're opening new issues again? Is there something special I'm supposed to put in the new issue? |
Yes, sorry. We know that, though. We tried both ways and like the first more.
Yes. |
I'm sorry for the churn in process. Per the Wiki doc listed above:
|
Glad to hear it is going to be automated. |
Closing this in favor of the backport issues as it was fixed in master. |
Addresses string comparison issue: golang/go#24817 Change-Id: I8a8a10f2739e8b1a4884f3b74db7a6b0db78f35b Reviewed-on: http://review.couchbase.org/93589 Well-Formed: Build Bot <build@couchbase.com> Reviewed-by: Marty Schoch <marty.schoch@gmail.com> Tested-by: Abhinav Dangeti <abhinav@couchbase.com>
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go1.10.1 (playground). This also reproduces with
go version devel +b1335037fa Wed Mar 7 22:03:43 2018 +0000 linux/amd64
.Does this issue reproduce with the latest release?
It does in the playground.
What did you do?
https://play.golang.org/p/qJc3MD8uB9j
What did you expect to see?
The two string comparisons should be the same, yielding
true
andtrue
.What did you see instead?
The text was updated successfully, but these errors were encountered: