Skip to content

ICE in translation phase while using DST: "Invalid operand types for ICmp instruction" #18353

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
japaric opened this issue Oct 26, 2014 · 1 comment · Fixed by #18591
Closed
Assignees
Labels
A-DSTs Area: Dynamically-sized types (DSTs) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.

Comments

@japaric
Copy link
Member

japaric commented Oct 26, 2014

I was playing with DST by reimplementing the str primitive as a struct Str([u8]), but hit an ICE while testing.

The code is in this gist

Output

$ RUST_BACKTRACE=1 rustc dstr.rs
rustc: /var/tmp/paludis/build/dev-lang-rust-scm/work/rust-scm/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.
[1]    30465 abort (core dumped)  rustc dstr.rs

Backtrace

#0  0x00007ffff62698a7 in raise () from /lib64/libc.so.6
#1  0x00007ffff626ac3a in abort () from /lib64/libc.so.6
#2  0x00007ffff62627fd in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007ffff62628b2 in __assert_fail () from /lib64/libc.so.6
#4  0x00007ffff3918608 in ?? () from /usr/lib64/librustc_llvm-4e7c5e5c.so
#5  0x00007ffff457b527 in LLVMBuildICmp () from /usr/lib64/librustc_llvm-4e7c5e5c.so
#6  0x00007ffff6e54a7f in middle::trans::builder::Builder$LT$$x27a$C$$x20$x27tcx$GT$::icmp::h4aa6ae27f256fabePje () from /usr/lib64/librustc-4e7c5e5c.so
#7  0x00007ffff6dd7830 in middle::trans::adt::trans_get_discr::ha443b7b22a4caa61VFv () from /usr/lib64/librustc-4e7c5e5c.so
#8  0x00007ffff6e8a6f8 in ?? () from /usr/lib64/librustc-4e7c5e5c.so
#9  0x00007ffff6e87858 in ?? () from /usr/lib64/librustc-4e7c5e5c.so
#10 0x00007ffff6e17603 in middle::trans::_match::trans_match::he701ef37a38be851Agk () from /usr/lib64/librustc-4e7c5e5c.so
#11 0x00007ffff6e05630 in ?? () from /usr/lib64/librustc-4e7c5e5c.so
#12 0x00007ffff6dc85fd in middle::trans::expr::trans_into::h8ae2b7a3d17060a8CD4 () from /usr/lib64/librustc-4e7c5e5c.so
#13 0x00007ffff6dc895f in middle::trans::controlflow::trans_block::h436e3d0d9803e356ST0 () from /usr/lib64/librustc-4e7c5e5c.so
#14 0x00007ffff6e713f8 in middle::trans::base::trans_closure::h231ca5ccc1f2e69at0g () from /usr/lib64/librustc-4e7c5e5c.so
#15 0x00007ffff6dbb07a in middle::trans::base::trans_fn::hadaba5b2481570fcRbh () from /usr/lib64/librustc-4e7c5e5c.so
#16 0x00007ffff6dbd4ce in middle::trans::monomorphize::monomorphic_fn::h4563fac28419b936ik0 () from /usr/lib64/librustc-4e7c5e5c.so
#17 0x00007ffff6df0b7c in middle::trans::callee::trans_fn_ref_with_substs::h8eabc21193fe07d6Hx3 () from /usr/lib64/librustc-4e7c5e5c.so
#18 0x00007ffff6dedd70 in middle::trans::callee::trans_fn_ref::h8d74fc054b8b7de4xl3 () from /usr/lib64/librustc-4e7c5e5c.so
#19 0x00007ffff6dd1ffc in middle::trans::meth::trans_method_callee::hbc28e9cef099c699gom () from /usr/lib64/librustc-4e7c5e5c.so
#20 0x00007ffff6df6dae in ?? () from /usr/lib64/librustc-4e7c5e5c.so
#21 0x00007ffff6dd0221 in middle::trans::callee::trans_call_inner::ha74736412897064crT3 () from /usr/lib64/librustc-4e7c5e5c.so
#22 0x00007ffff6df6bb1 in middle::trans::callee::trans_method_call::h99ff4f13e516b804TO3 () from /usr/lib64/librustc-4e7c5e5c.so
#23 0x00007ffff6e05136 in ?? () from /usr/lib64/librustc-4e7c5e5c.so
#24 0x00007ffff6e03e73 in ?? () from /usr/lib64/librustc-4e7c5e5c.so
#25 0x00007ffff6dc9a0c in middle::trans::expr::trans::h159a4d5c8110b09awH4 () from /usr/lib64/librustc-4e7c5e5c.so
#26 0x00007ffff6e662f3 in middle::trans::_match::store_local::hd8b63d9160463155Vtk () from /usr/lib64/librustc-4e7c5e5c.so
#27 0x00007ffff6dc7b58 in middle::trans::base::init_local::h4a9b7e04850a284b38f () from /usr/lib64/librustc-4e7c5e5c.so
#28 0x00007ffff6dc6f90 in middle::trans::controlflow::trans_stmt::h89e8a60881dc9d7cMO0 () from /usr/lib64/librustc-4e7c5e5c.so
#29 0x00007ffff6dc8868 in middle::trans::controlflow::trans_block::h436e3d0d9803e356ST0 () from /usr/lib64/librustc-4e7c5e5c.so
#30 0x00007ffff6e713f8 in middle::trans::base::trans_closure::h231ca5ccc1f2e69at0g () from /usr/lib64/librustc-4e7c5e5c.so
#31 0x00007ffff6dbb07a in middle::trans::base::trans_fn::hadaba5b2481570fcRbh () from /usr/lib64/librustc-4e7c5e5c.so
#32 0x00007ffff6db86df in middle::trans::base::trans_item::hfe038ac56abea028avh () from /usr/lib64/librustc-4e7c5e5c.so
#33 0x00007ffff6e7ab99 in middle::trans::base::trans_crate::h88329c3ddbae368c1si () from /usr/lib64/librustc-4e7c5e5c.so
#34 0x00007ffff72c8d15 in driver::driver::phase_4_translate_to_llvm::h16ffd3985d271c57d5z () from /usr/lib64/librustc-4e7c5e5c.so
#35 0x00007ffff72c147a in driver::driver::compile_input::h1a790388d99652637Bz () from /usr/lib64/librustc-4e7c5e5c.so
#36 0x00007ffff734b7bc in ?? () from /usr/lib64/librustc-4e7c5e5c.so
#37 0x00007ffff7349735 in ?? () from /usr/lib64/librustc-4e7c5e5c.so
#38 0x00007ffff6a4e108 in ?? () from /usr/lib64/librustc-4e7c5e5c.so
#39 0x00007ffff6a4e003 in ?? () from /usr/lib64/librustc-4e7c5e5c.so
#40 0x00007ffff7bafdc2 in ?? () from /usr/lib64/libnative-4e7c5e5c.so
#41 0x00007ffff669566c in ?? () from /usr/lib64/librustrt-4e7c5e5c.so
#42 0x00007ffff6695656 in rust_try () from /usr/lib64/librustrt-4e7c5e5c.so
#43 0x00007ffff6642d03 in unwind::try::h59906d5b05b381f7uFd () from /usr/lib64/librustrt-4e7c5e5c.so
#44 0x00007ffff6642bbc in task::Task::run::h4be314de5a9e0a0fkLc () from /usr/lib64/librustrt-4e7c5e5c.so
#45 0x00007ffff7bafb87 in ?? () from /usr/lib64/libnative-4e7c5e5c.so
#46 0x00007ffff6644621 in ?? () from /usr/lib64/librustrt-4e7c5e5c.so
#47 0x00007ffff597d294 in start_thread () from /lib64/libpthread.so.0
#48 0x00007ffff631e1ed in clone () from /lib64/libc.so.6

Version

rustc 0.13.0-dev (80e5fe1a5 2014-10-25 09:17:05 +0000)

cc @bkoropoff This seems similar to #17206
cc @nick29581

@sfackler sfackler added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Oct 26, 2014
@nrc nrc added the A-DSTs Area: Dynamically-sized types (DSTs) label Oct 27, 2014
@nrc
Copy link
Member

nrc commented Nov 3, 2014

Minimal test case:

struct Str {
    f: [u8]
}

fn main() {
    let str: Option<&Str> = None;
    str.is_some();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-DSTs Area: Dynamically-sized types (DSTs) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants