Closed
Description
This is a recently introduced ICE that appears with -Copt-level=3
using rustc 1.13.0-nightly (5531c31 2016-09-12)
rustc: /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/IR/Value.cpp:373: void llvm::Value::replaceAllUsesWith(llvm::Value*): Assertion `!contains(New, this) && "this->replaceAllUsesWith(expr(this)) is NOT valid!"' failed.
Shrunk test case below (original is in ndarray tests/dimension.rs). Use rustc -Copt-level=3
to reproduce.
fn main() {
remove_axis(&3, 0);
}
trait Dimension {
fn slice(&self) -> &[usize];
}
impl Dimension for () {
fn slice(&self) -> &[usize] { &[] }
}
impl Dimension for usize {
fn slice(&self) -> &[usize] {
unsafe {
::std::slice::from_raw_parts(self, 1)
}
}
}
fn remove_axis(value: &usize, axis: usize) -> () {
let tup = ();
let mut it = tup.slice().iter();
for (i, _) in value.slice().iter().enumerate() {
if i == axis {
continue;
}
it.next();
}
}
(Edits: Reduced test case further)
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️High priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from stable to beta.