Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
src/librustc_trans/abi.rs
Outdated
There was a problem hiding this comment.
If y == 0, then x % y will also panic, please move this rem_bytes calculation inside the conditional as well.
|
☔ The latest upstream changes (presumably #50615) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Should the test file be added to codegen tests? I've added a ui test because we just want to ensure that the code from the issue passes compilation right? |
|
Sorry for the commit spam after rebasing :( I can remove or squash them when I get a sec again |
|
@cjkenn Yes, please |
8ae861b to
7094e7f
Compare
|
Err hopefully this is better after some more git fiddling -_-... I didn't squash them but the diffs are right. |
|
@cjkenn Could you do a rebase instead of merge? $ git checkout master
$ git pull origin master --ff-only # synchronize master branch with this repository
$ git checkout div-by-zero
$ git rebase master # rebase on top of the latest master
$ git rebase -i master # do more cleanup e.g. squash everything down to a single commit
$ git push cjkenn div-by-zero --force-with-lease |
remove semicolon -_- Add rem_bytes to conditional to avoid error when performing mod by 0 Add test file to confirm compilation passes. Ensure we don't divide or mod by zero in llvm_type. Include test file from issue.
987fb20 to
ecce274
Compare
|
Ok, I think I've FINALLY got it... Thanks for the git help! |
kennytm
left a comment
There was a problem hiding this comment.
r=me after a minor nit is fixed.
src/test/ui/issue-50761.rs
Outdated
|
|
||
| // compile-pass | ||
|
|
||
| #![feature(test)] |
|
@bors r+ |
|
📌 Commit 8d9a87c has been approved by |
Fix potential divide by zero This should fix rust-lang#50761 I had trouble reproducing with the provided code, but looking at the stack trace would indicate that this code is the likely cause. I made a number of assumptions here, because I don't have enough context on how the register size is set: 1. I assumed `rest.unit.size.bytes()` can be 0, and it's ok if it's set to 0 before this function is called 2. I assumed that if `rest.unit.size.bytes()` is 0, that we want `rest_count` to also be 0.
Rollup of 8 pull requests Successful merges: - #50531 (Cleanup uses of TypeIdHasher and replace them with StableHasher) - #50819 (Fix potential divide by zero) - #50827 (Update LLVM to 56c931901cfb85cd6f7ed44c7d7520a8de1edf97) - #50829 (CheckLoopVisitor: also visit break expressions) - #50854 (in which the unused shorthand field pattern debacle/saga continues) - #50858 (Reorder description for snippets in rustdoc documentation) - #50883 (Fix warning when building stage0 libcore) - #50889 (Update clippy) Failed merges:
This should fix #50761
I had trouble reproducing with the provided code, but looking at the stack trace would indicate that this code is the likely cause. I made a number of assumptions here, because I don't have enough context on how the register size is set:
rest.unit.size.bytes()can be 0, and it's ok if it's set to 0 before this function is calledrest.unit.size.bytes()is 0, that we wantrest_countto also be 0.