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

[ICE] "ty_size: unhandled type" when using a SIMD type in FFI #20043

Closed
kennytm opened this issue Dec 19, 2014 · 1 comment · Fixed by #21233
Closed

[ICE] "ty_size: unhandled type" when using a SIMD type in FFI #20043

kennytm opened this issue Dec 19, 2014 · 1 comment · Fixed by #21233
Labels
A-ffi Area: Foreign Function Interface (FFI) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@kennytm
Copy link
Member

kennytm commented Dec 19, 2014

Example code

#![allow(dead_code)]
use std::simd::u64x2;
extern {
    fn foo(a: u64x2);
}
fn main() {}

This fails with:

error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' panicked at 'ty_size: unhandled type', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/librustc_trans/trans/cabi_x86_64.rs:146

stack backtrace:
   1:        0x104bd5130 - rt::backtrace::imp::write::h6bfacabc152a107af1x
   2:        0x104bd8721 - failure::on_fail::h004240af5c8bff3bWny
   3:        0x104e3ff55 - unwind::begin_unwind_inner::h2bc1d2ba239d03629Ec
   4:        0x101b6b22c - unwind::begin_unwind::h13950834142134723930
   5:        0x101cbcd0b - trans::cabi_x86_64::classify_ty::ty_size::hbc87c34bce054a64VNA
   6:        0x101cbc8f5 - trans::cabi_x86_64::classify_ty::h08570c25d40b0525vLA
   7:        0x101cba72f - trans::cabi::compute_abi_info::h195a5df35ad95172bwA
   8:        0x101cbe329 - trans::foreign::foreign_types_for_fn_ty::hd2c1e54723b16f79lMC
   9:        0x101c5901f - trans::foreign::register_foreign_item_fn::hb781bfb3ebdf946fsDB
  10:        0x101ba73c5 - trans::base::trans_item::heb324ea32fa423578Eu
  11:        0x101c6abb8 - trans::base::trans_crate::hba3b16755eb22180jBv
  12:        0x101406eae - driver::phase_4_translate_to_llvm::h9c2fab499036a1b9XCa
  13:        0x1013e0c58 - driver::compile_input::h8cefb00def448166rba
  14:        0x1015652c5 - run_compiler::hdf31023103b0c737AYb
  15:        0x10155b0dd - thunk::F.Invoke<A, R>::invoke::h6761157341938668982
  16:        0x104bade59 - thunk::F.Invoke<A, R>::invoke::h16129900982312133975
  17:        0x104e3e5c9 - task::Task::spawn_thunk::closure.5620
  18:        0x104ea72fc - rust_try_inner
  19:        0x104ea72e6 - rust_try
  20:        0x104e3e6b7 - unwind::try::h956380dd3aadd40dquc
  21:        0x104e3e45c - task::Task::run::h0dabcd2eaf1030d1oLb
  22:        0x104e3ddf4 - thunk::F.Invoke<A, R>::invoke::h356599560990785622
  23:        0x104e3f514 - thread::thread_start::h1abd83bbbd15cd00I2b
  24:     0x7fff87a8f2fc - _pthread_body
  25:     0x7fff87a8f279 - _pthread_body
$ rustc -v
rustc 0.13.0-nightly (42deaa5e4 2014-12-16 17:51:23 +0000)
@huonw huonw added A-ffi Area: Foreign Function Interface (FFI) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Dec 19, 2014
@huonw
Copy link
Member

huonw commented Dec 29, 2014

cc me

This is unfortunate since one could probably use e.g. extern {#[link_name = "llvm.sqrt.f32"] fn vsqrt(x: f32x4); } as a hack to be able to use vector operations that aren't provided in any other way.

huonw added a commit to huonw/rust that referenced this issue Jan 16, 2015
This seems to work on x86-64, but I am not able to test on other
platforms.

cc rust-lang#20043
bors added a commit that referenced this issue Jan 17, 2015
This stops the compiler ICEing on the use of SIMD types in FFI signatures. It emits correct code for LLVM intrinsics, but I am quite unsure about the ABI handling in general so I've added a new feature gate `simd_ffi` to try to ensure people don't use it without realising there's a non-trivial risk of codegen brokenness.

Closes #20043.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ffi Area: Foreign Function Interface (FFI) 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