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 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

@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Feb 13, 2020

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 13, 2020

📌 Commit 10f342a has been approved by oli-obk

@elichai

This comment has been minimized.

Copy link
Contributor

elichai commented Feb 13, 2020

Makes more sense :)

Dylan-DPC added a commit to Dylan-DPC/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
4 checks passed
4 checks passed
pr Build #20200213.15 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
@RalfJung RalfJung deleted the RalfJung:exact-div branch Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.