Skip to content
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

miri: fix exact_div #69126

Merged
merged 1 commit into from
Feb 14, 2020
Merged

miri: fix exact_div #69126

merged 1 commit into from
Feb 14, 2020

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Feb 13, 2020

Turns out exact_div was relying on the broken behavior of Rem for int_min % -1 that was fixed in #69002. This PR fixes exact_div.

Inside rustc, exact_div is only used in a single place where the divisor is always positive (in ptr_offset_from), so we cannot test the fix in rustc. The Miri test suite covers this through the exact_div intrinsic, though (and it is how I found out).

One step to #69117 (then we also need to address build failures introduced by #68969)

r? @oli-obk

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 13, 2020
@oli-obk
Copy link
Contributor

oli-obk commented Feb 13, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Feb 13, 2020

📌 Commit 10f342a has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 13, 2020
@elichai
Copy link
Contributor

elichai commented Feb 13, 2020

Makes more sense :)

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Feb 13, 2020
miri: fix exact_div

Turns out `exact_div` was relying on the broken behavior of `Rem` for `int_min % -1` that was fixed in rust-lang#69002. This PR fixes `exact_div`.

Inside rustc, `exact_div` is only used in a single place where the divisor is always positive (in `ptr_offset_from`), so we cannot test the fix in rustc. The Miri test suite covers this through the `exact_div` intrinsic, though (and it is how I found out).

One step to rust-lang#69117 (then we also need to address build failures introduced by rust-lang#68969)

r? @oli-obk
bors added a commit that referenced this pull request Feb 13, 2020
Rollup of 9 pull requests

Successful merges:

 - #68728 (parse: merge `fn` syntax + cleanup item parsing)
 - #68938 (fix lifetime shadowing check in GATs)
 - #69057 (expand: misc cleanups and simplifications)
 - #69108 (Use HirId in TraitCandidate.)
 - #69125 (Add comment to SGX entry code)
 - #69126 (miri: fix exact_div)
 - #69127 (Enable use after scope detection in the new LLVM pass manager)
 - #69135 (Spelling error "represening" to "representing")
 - #69141 (Don't error on network failures)

Failed merges:

r? @ghost
@bors bors merged commit 10f342a into rust-lang:master Feb 14, 2020
@RalfJung RalfJung deleted the exact-div branch February 17, 2020 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants