Repository navigation
slice::get_mut() followed by slice::copy_from_slice generates unreachable panic branch #98294
Copy link
Copy link
Closed
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
Activity
- changed the title
[-]`slice::get[_mut]()` followed by `slice::copy_from_slice` generates unreachable panic branch[/-][+]`slice::get_mut()` followed by `slice::copy_from_slice` generates unreachable panic branch[/+]on Jun 20, 2022 - addedregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.C-bugCategory: This is a bug.Category: This is a bug.
on Jul 27, 2022 - addedI-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}Issue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
on Jul 27, 2022 @rustbot label I-slow, E-needs-bisection
- addedE-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcI-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.
on Jul 27, 2022 - addedT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
on Aug 3, 2022 This seems to be fixed on nightly. @rustbot label E-needs-test
Bisection would still be interesting IMO, both for the regression and the fix.
- addedE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
on Aug 30, 2022 Alright, that’s pretty boring in terms of rustc-bisection: it was fixed by #99464 (Update to LLVM 15), and it regressed in
nightly-2021-03-05which includes #81451 (Upgrade1 to LLVM 12).@rustbot label -E-needs-bisection, +A-llvm.
Footnotes
-
what’s up with the inconsistent naming, upgrade vs. update? ↩
-
- addedA-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.and removedE-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
on Aug 30, 2022 - removedI-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}Issue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
on Aug 31, 2022
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
In code like the following, the compiler misses a possible optimization: in
f1, the length ofdstis equal to the length ofbytes, yet the compiler generates a call tolen_mismatch_fail.The compiler knows the lengths are equal (and thus, the panic is unreachable), because the following snippet optimizes the panic away:
This is a regression between rustc versions 1.51 and 1.52.
https://rust.godbolt.org/z/YhEY78E9P