-
Notifications
You must be signed in to change notification settings - Fork 18.5k
cmd/compile: make prove use non-equality in subtraction for a stronger bound #76609
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
base: master
Are you sure you want to change the base?
Conversation
|
This PR (HEAD: 7c1e778) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/725100. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Jonah Uellenberg: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Keith Randall: Patch Set 3: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Keith Randall: Patch Set 3: Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Go LUCI: Patch Set 3: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2025-12-02T17:48:53Z","revision":"6b37a5903598ad242dd409e5b780f7367e528c16"} Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Keith Randall: Patch Set 3: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Go LUCI: Patch Set 3: This CL has failed the run. Reason: Failed Tryjobs:
To reproduce, try Additional links for debugging:
To reproduce, try Additional links for debugging: Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Go LUCI: Patch Set 3: LUCI-TryBot-Result-1 Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Keith Randall: Patch Set 3: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
…r bound Given: s := /* slice */ k := /* proved valid index in s (0 <= k < len(s)) */ v := s[k:] len(v) >= 1, so v[0] needs no bounds check. However, for len(v) = len(s) - k, we only checked if len(s) >= k and so could only prove len(v) >= 0, thus the bounds check wasn't removed. As far as I can tell these checks were commented out for performance, but after benchmarking prove I see no difference. Fixes: golang#76429
7c1e778 to
8c6a579
Compare
|
This PR (HEAD: 8c6a579) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/725100. Important tips:
|
|
Message from Jonah Uellenberg: Patch Set 4: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Keith Randall: Patch Set 4: Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Go LUCI: Patch Set 4: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2025-12-04T01:16:00Z","revision":"8a54334d97857adbc3d52c348c9703a646649cb3"} Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Jorropo: Patch Set 4: Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Keith Randall: Patch Set 4: Code-Review+2 Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Keith Randall: Patch Set 4: Code-Review+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Jorropo: Patch Set 4: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Keith Randall: Patch Set 4: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Go LUCI: Patch Set 4: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Go LUCI: Patch Set 4: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Keith Randall: Patch Set 4: Auto-Submit+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
|
Message from Jorropo: Patch Set 4: Code-Review+2 Please don’t reply on this GitHub thread. Visit golang.org/cl/725100. |
Given:
s := /* slice /
k := / proved valid index in s (0 <= k < len(s)) */
v := s[k:]
len(v) >= 1, so v[0] needs no bounds check. However, for
len(v) = len(s) - k, we only checked if len(s) >= k and so could only
prove len(v) >= 0, thus the bounds check wasn't removed.
As far as I can tell these checks were commented out for performance,
but after benchmarking prove I see no difference.
Fixes: #76429