Skip to content
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

LLVM assertion using bare self value #5321

Closed
jdm opened this issue Mar 11, 2013 · 5 comments
Closed

LLVM assertion using bare self value #5321

jdm opened this issue Mar 11, 2013 · 5 comments
Assignees
Labels
A-codegen Area: Code generation A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-trait-system Area: Trait system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Milestone

Comments

@jdm
Copy link
Contributor

jdm commented Mar 11, 2013

trait FTErrorMethods {
    fn succeeded(self) -> bool;
}

impl FTErrorMethods for int {
    fn succeeded(self) -> bool { self == 0 }
}

fn main() {
    5.succeeded();
}
rustc: /run/media/jdm/ssd/rust/src/llvm/lib/VMCore/Instructions.cpp:2383: static llvm::CastInst* llvm::CastInst::CreatePointerCast(llvm::Value*, llvm::Type*, const llvm::Twine&, llvm::Instruction*): Assertion `S->getType()->isPointerTy() && "Invalid cast"' failed.
#4  0x00007ffff62dc216 in llvm::CastInst::CreatePointerCast(llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*) () from /usr/local/bin/../lib/librustllvm.so
#5  0x00007ffff6268fe0 in llvm::IRBuilder<true, llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<true> >::CreatePointerCast(llvm::Value*, llvm::Type*, llvm::Twine const&) ()
   from /usr/local/bin/../lib/librustllvm.so
#6  0x00007ffff6265f35 in LLVMBuildPointerCast () from /usr/local/bin/../lib/librustllvm.so
#7  0x00007ffff74191c2 in LLVMBuildPointerCast__c_stack_shim () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#8  0x00007ffff54e7649 in __morestack () from /usr/local/bin/../lib/librustrt.so
#9  0x00007ffff54d8104 in call_on_c_stack (fn_ptr=0x7ffff7419180, args=0x7fffe849a998, this=0x7ffff0108830) at /run/media/jdm/ssd/rust/src/rt/rust_task.h:478
#10 upcall_call_shim_on_c_stack (args=0x7fffe849a998, fn_ptr=0x7ffff7419180) at /run/media/jdm/ssd/rust/src/rt/rust_upcall.cpp:64
#11 0x00007ffff6d9c09a in middle::trans::build::PointerCast::_aee05de3d6b51f11::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#12 0x00007ffff6ddd6ce in middle::trans::callee::trans_call_inner::anon::expr_fn_27457 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#13 0x00007ffff6d991cc in middle::trans::base::with_scope::_518696e6502795b0::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#14 0x00007ffff6dcf435 in middle::trans::callee::trans_method_call::_12bb7b81ca47a09::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#15 0x00007ffff6de983c in middle::trans::expr::trans_rvalue_dps_unadjusted::_cbdc4c02519225::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#16 0x00007ffff6de4b64 in middle::trans::expr::trans_to_datum_unadjusted::_a2a3224b30364953::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#17 0x00007ffff6d50cc0 in middle::trans::expr::trans_to_datum::_a2a3224b30364953::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#18 0x00007ffff6de7d4e in middle::trans::expr::trans_rvalue_datum_unadjusted::_a2a3224b30364953::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#19 0x00007ffff6de47fa in middle::trans::expr::trans_to_datum_unadjusted::_a2a3224b30364953::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#20 0x00007ffff6d50cc0 in middle::trans::expr::trans_to_datum::_a2a3224b30364953::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#21 0x00007ffff6d4e7ca in middle::trans::controlflow::trans_if::_fcc7ad9922f2f49::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#22 0x00007ffff6de9c99 in middle::trans::expr::trans_rvalue_dps_unadjusted::_cbdc4c02519225::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#23 0x00007ffff6d4de34 in middle::trans::expr::trans_into::_cbdc4c02519225::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#24 0x00007ffff7434814 in __morestack () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#25 0x00007ffff6d4cf3d in middle::trans::base::trans_stmt::_d936d389a86c7a66::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#26 0x00007ffff6d4c426 in middle::trans::controlflow::trans_block::anon::expr_fn_21837 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#27 0x00007ffff6d4a66e in middle::trans::controlflow::trans_block::_84b7ff1756c49e1::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#28 0x00007ffff6e513b7 in middle::trans::base::trans_closure::_33dc6c6bc3c467::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#29 0x00007ffff6d03624 in middle::trans::base::trans_fn::_bbb928f648ebbdfa::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#30 0x00007ffff6cfb180 in middle::trans::base::trans_item::_e5c80d83455a852::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#31 0x00007ffff6e57e30 in middle::trans::base::trans_mod::_f6b5437a924015ec::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#32 0x00007ffff6e75e5b in middle::trans::base::trans_crate::_685731d1dcd33aec::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#33 0x00007ffff73f4993 in driver::driver::compile_rest::_3dc0cd32a85c34a0::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#34 0x00007ffff7434814 in __morestack () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#35 0x00007ffff73f6ef7 in driver::driver::compile_upto::_23bd5d90dda9e867::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#36 0x00007ffff7434814 in __morestack () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#37 0x00007ffff73f72f9 in driver::driver::compile_input::_594ffb6142f762a7::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#38 0x00007ffff742542f in run_compiler::_c936523e1243e7f::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#39 0x00007ffff7432151 in monitor::anon::expr_fn_82369 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#40 0x00007ffff742e57b in task::__extensions__::try_81880::anon::expr_fn_82143 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#41 0x00007ffff7434814 in __morestack () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#42 0x00007ffff7df363a in task::spawn::spawn_raw::make_child_wrapper::anon::expr_fn_11480 () from /usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.6.so
#43 0x00007ffff7e5aa20 in __morestack () from /usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.6.so
#44 0x00007ffff54d70a4 in task_start_wrapper (a=0x7ffff0109660) at /run/media/jdm/ssd/rust/src/rt/rust_task.cpp:162
#45 0x0000000000000000 in ?? ()
@graydon
Copy link
Contributor

graydon commented Apr 29, 2013

note that switching to &self here does work; but I agree this is a bug

@graydon
Copy link
Contributor

graydon commented Apr 30, 2013

assigning bug; change assignment if you disagree

@emberian
Copy link
Member

emberian commented May 6, 2013

Adding a teensy bit of logging to PointerCast (log span_to_str of the block) shows that PointerCast is dying on 5.succeeded().

@emberian
Copy link
Member

emberian commented May 6, 2013

@Aatch deduced that this bug only emerges when using a self-by-value trait on a primitive type. #4406 and this are duplicates, I believe.

luqmana added a commit to luqmana/rust that referenced this issue May 20, 2013
luqmana added a commit to luqmana/rust that referenced this issue May 24, 2013
luqmana added a commit that referenced this issue Jun 2, 2013
@catamorphism
Copy link
Contributor

Reproduced with efd1438

luqmana added a commit to luqmana/rust that referenced this issue Jun 28, 2013
@bors bors closed this as completed in 61dc776 Jun 28, 2013
bors added a commit to rust-lang-ci/rust that referenced this issue May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-trait-system Area: Trait system 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.

5 participants