Skip to content

LLVM Assertion on Pattern Match + Unique #23433

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
jamwt opened this issue Mar 17, 2015 · 1 comment · Fixed by #24807
Closed

LLVM Assertion on Pattern Match + Unique #23433

jamwt opened this issue Mar 17, 2015 · 1 comment · Fixed by #24807
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@jamwt
Copy link

jamwt commented Mar 17, 2015

Given the following code:

#![feature(unique)]
#![allow(unused_variables)]

use std::ptr::Unique;

fn main() {
    let mut a = [0u8; 5];
    let b: Option<Unique<[u8]>> = unsafe { Some(Unique::new(&mut a)) };
    match b {
        Some(ref inner) => println!("it's a some"),
        None => println!("it's a none"),
    }
}

Rustc bails out on an LLVM assertion:

rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/include/llvm/IR/Instructions.h:1001: void llvm::ICmpInst::AssertOK(): Assertion `(getOperand(0)->getType()->isIntOrIntVectorTy() || getOperand(0)->getType()->isPtrOrPtrVectorTy()) && "Invalid operand types for ICmp instruction"' failed.

Here's the stack:

#0  0x00007ffff6fda0d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff6fdd83b in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff6fd2d9e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007ffff6fd2e42 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x00007ffff207021f in llvm::ICmpInst::AssertOK() () from /usr/local/lib/librustc_llvm-4e7c5e5c.so
#5  0x00007ffff20702cb in llvm::IRBuilder<true, llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<true> >::CreateICmp(llvm::CmpInst::Predicate, llvm::Value*, llvm::Value*, llvm::Twine const&) [clone .part.491] () from /usr/local/lib/librustc_llvm-4e7c5e5c.so
#6  0x00007ffff3108e8f in LLVMBuildICmp () from /usr/local/lib/librustc_llvm-4e7c5e5c.so
#7  0x00007ffff6b42900 in trans::build::ICmp::h70eb28ee2d0546d5aMp () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#8  0x00007ffff6b3eefe in trans::adt::trans_get_discr::h6649ce41ceb444a9zFH () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#9  0x00007ffff6c176b9 in trans::_match::compile_submatch_continue::h39a18e8f0a879054gdw () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#10 0x00007ffff6c135af in trans::_match::compile_submatch::h3accf2ac93c439ddJ7v () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#11 0x00007ffff6c1d120 in trans::_match::trans_match_inner::h727c41a4ddfa6f515Ew () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#12 0x00007ffff6b71b03 in trans::expr::trans_rvalue_dps_unadjusted::hae9fe8e72b025d32xzi () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#13 0x00007ffff6b22a51 in trans::expr::trans_into::h9bfce6438b73e9acSmh () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#14 0x00007ffff6b23b68 in trans::controlflow::trans_block::hcba31267fa6c4968t6d () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#15 0x00007ffff6b71b5f in trans::expr::trans_rvalue_dps_unadjusted::hae9fe8e72b025d32xzi () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#16 0x00007ffff6b22a51 in trans::expr::trans_into::h9bfce6438b73e9acSmh () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#17 0x00007ffff6c34be8 in trans::_match::mk_binding_alloca::h16265078090998076011 () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#18 0x00007ffff6b21fae in trans::base::init_local::h9921fd3a372311dbVys () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#19 0x00007ffff6b23843 in trans::controlflow::trans_block::hcba31267fa6c4968t6d () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#20 0x00007ffff6bfb462 in trans::base::trans_closure::h295e0a8c0302a522Rjt () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#21 0x00007ffff6b0bf59 in trans::base::trans_fn::h475c276dfb9092deKut () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#22 0x00007ffff6b08527 in trans::base::trans_item::hc022dcad9f32230fCSt () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#23 0x00007ffff6b08369 in trans::base::trans_item::hc022dcad9f32230fCSt () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#24 0x00007ffff6c0458d in trans::base::trans_crate::ha116a53daafe15a4fPu () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#25 0x00007ffff7afd554 in driver::phase_4_translate_to_llvm::hb0c3ed9b413b640akOa () from /usr/local/lib/librustc_driver-4e7c5e5c.so
#26 0x00007ffff7ad9144 in driver::compile_input::h56dbe0e66fe8a956Rba () from /usr/local/lib/librustc_driver-4e7c5e5c.so
#27 0x00007ffff7b90a43 in run_compiler::hbbbe30f1ad654d0ex2b () from /usr/local/lib/librustc_driver-4e7c5e5c.so
#28 0x00007ffff7b8e88d in thunk::F.Invoke$LT$A$C$$u20$R$GT$::invoke::h9510793753674638958 () from /usr/local/lib/librustc_driver-4e7c5e5c.so
#29 0x00007ffff7b8d911 in rt::unwind::try::try_fn::h15118916039308917284 () from /usr/local/lib/librustc_driver-4e7c5e5c.so
#30 0x00007ffff7560f59 in rust_try_inner () from /usr/local/lib/libstd-4e7c5e5c.so
#31 0x00007ffff7560f46 in rust_try () from /usr/local/lib/libstd-4e7c5e5c.so
#32 0x00007ffff7b8ddb7 in thunk::F.Invoke$LT$A$C$$u20$R$GT$::invoke::h8595907971712275588 () from /usr/local/lib/librustc_driver-4e7c5e5c.so
#33 0x00007ffff74de996 in sys::thread::thread_start::h9f0c06661d546448B1G () from /usr/local/lib/libstd-4e7c5e5c.so
#34 0x00007ffff138ae9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#35 0x00007ffff70982ed in clone () from /lib/x86_64-linux-gnu/libc.so.6
#36 0x0000000000000000 in ?? ()

And here's the vitals:

~$ rustc --version
rustc 1.0.0-nightly (30e1f9a1c 2015-03-14) (built 2015-03-15)
~$ uname -a
Linux dbdev 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Playpen link that also fails on 2015-03-16: http://is.gd/yYChkD

@jdm jdm added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Mar 17, 2015
@jamwt
Copy link
Author

jamwt commented Mar 17, 2015

/cc @luqmana

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

Successfully merging a pull request may close this issue.

2 participants