Skip to content

Unreachable division causes LLVM assertion error #21006

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

Closed
klutzy opened this issue Jan 12, 2015 · 1 comment
Closed

Unreachable division causes LLVM assertion error #21006

klutzy opened this issue Jan 12, 2015 · 1 comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@klutzy
Copy link
Contributor

klutzy commented Jan 12, 2015

fn f(n: u8) {
    panic!();
    let n = n / 1;
}

fn main() {
    f(1);
}
rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/
src/llvm/lib/IR/Constants.cpp:1835:
static llvm::Constant* llvm::ConstantExpr::get(unsigned int, llvm::Constant*, llvm::Constant*, unsigned int, llvm::Type*):
Assertion `C1->getType() == C2->getType() &&
"Operand types in binary constant expression should match"' failed.

Replacing n / 1 with n / n gives:

rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/
src/llvm/lib/IR/Instructions.cpp:1086:
void llvm::StoreInst::AssertOK():
Assertion `getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() &&
"Ptr must be a pointer to Val type!"' failed.
@jdm jdm added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jan 12, 2015
@dotdash
Copy link
Contributor

dotdash commented Feb 28, 2015

This compiles fine with rustc 1.0.0-dev (48aeaba93 2015-02-28) (built 2015-02-28)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants