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 when compiling an FFI binding with a certain type #3656

Closed
Blei opened this issue Oct 4, 2012 · 0 comments
Closed

ICE when compiling an FFI binding with a certain type #3656

Blei opened this issue Oct 4, 2012 · 0 comments
Labels
A-FFI Area: Foreign function interface (FFI) A-linkage Area: linking into static, shared libraries and binaries I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Milestone

Comments

@Blei
Copy link
Contributor

Blei commented Oct 4, 2012

The following small binding produces an ICE:

use libc::*;

pub struct KEYGEN {
    hash_algorithm: [c_uint]/2,
    count: uint32_t,
    salt: *c_void,
    salt_size: uint32_t,
}

extern {
    pub fn mhash_keygen_ext(++data: KEYGEN);
}

According to some comments in the IRC channel, the ++ mode is necessary to comply to the C ABI.

Trace:

% RUST_LOG=rustc=0,::rt::backtrace rustc --lib fail.rs 
warning: missing crate link meta `name`, using `fail` as default
warning: missing crate link meta `vers`, using `0.0` as default
rust: task failed at 'index out of bounds: the len is 3 but the index is 3', /home/philipp/programming/rust-git/src/rustc/middle/trans/foreign.rs:138
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x5d)[0x7f96e557670d]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustrt.so(+0x31fed)[0x7f96e558dfed]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustrt.so(upcall_fail+0x1a8)[0x7f96e5579008]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/libcore-c3ca5d77d81b46c1-0.4.so(_ZN2rt20rt_fail_bounds_check17_e739cc78d15657703_04E+0x1a0)[0x7f96e6b9c360]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-c84825241471686d-0.4.so(+0x24c007)[0x7f96e5a0a007]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-c84825241471686d-0.4.so(+0x24c17a)[0x7f96e5a0a17a]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-c84825241471686d-0.4.so(+0x24c2e8)[0x7f96e5a0a2e8]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-c84825241471686d-0.4.so(+0x24c2e8)[0x7f96e5a0a2e8]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-c84825241471686d-0.4.so(+0x24d4b4)[0x7f96e5a0b4b4]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-c84825241471686d-0.4.so(+0x24f060)[0x7f96e5a0d060]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-c84825241471686d-0.4.so(+0x24cdae)[0x7f96e5a0adae]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-c84825241471686d-0.4.so(+0x24fff4)[0x7f96e5a0dff4]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-c84825241471686d-0.4.so(+0x252d50)[0x7f96e5a10d50]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-c84825241471686d-0.4.so(_ZN6middle5trans7foreign17trans_foreign_mod17_3368894e4dbb26b13_04E+0xce)[0x7f96e59bd0ae]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-c84825241471686d-0.4.so(_ZN6middle5trans4base10trans_item16_de1f8cec64c49493_04E+0x19f)[0x7f96e58ae18f]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-c84825241471686d-0.4.so(_ZN6middle5trans4base9trans_mod16_583ddc9f4c3703c3_04E+0x8f)[0x7f96e59bcf5f]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-c84825241471686d-0.4.so(_ZN6middle5trans4base11trans_crate17_fd92dc19557ff9d53_04E+0x149a)[0x7f96e59d69ca]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-c84825241471686d-0.4.so(_ZN6driver6driver12compile_upto15_aa75a51be7967c3_04E+0x2560)[0x7f96e5e213b0]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-c84825241471686d-0.4.so(+0x68d2a0)[0x7f96e5e4b2a0]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-c84825241471686d-0.4.so(_ZN6driver6driver13compile_input17_a1da55cea41e7ba53_04E+0xbd)[0x7f96e5e2379d]
rustc[0x408d68]
rustc[0x4120c4]
rustc[0x40e543]
rustc[0x40d1fc]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/libcore-c3ca5d77d81b46c1-0.4.so(+0x75ef4)[0x7f96e6bd0ef4]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/libcore-c3ca5d77d81b46c1-0.4.so(+0xb7150)[0x7f96e6c12150]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x24)[0x7f96e5576eb4]
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=0,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', /home/philipp/programming/rust-git/src/rustc/driver/rustc.rs:275
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x5d)[0x7f96e557670d]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustrt.so(+0x31fed)[0x7f96e558dfed]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustrt.so(upcall_fail+0x1a8)[0x7f96e5579008]
rustc(_rust_main+0xbf4)[0x411c94]
rustc[0x4120c4]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x24)[0x7f96e5576eb4]
rust: domain main @0x1d99240 root task failed
rust: task failed at 'killed', /home/philipp/programming/rust-git/src/libcore/task.rs:662
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x5d)[0x7f96e557670d]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustrt.so(+0x31fed)[0x7f96e558dfed]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustrt.so(upcall_fail+0x1a8)[0x7f96e5579008]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/libcore-c3ca5d77d81b46c1-0.4.so(_ZN4task5yield16_9531951b4f79f8b3_04E+0xbd)[0x7f96e6bba4ad]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/libcore-c3ca5d77d81b46c1-0.4.so(+0x90d76)[0x7f96e6bebd76]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/libcore-c3ca5d77d81b46c1-0.4.so(_ZN7private11weaken_task16_1454432f47864e73_04E+0xd2)[0x7f96e6bebbb2]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/libcore-c3ca5d77d81b46c1-0.4.so(+0x90aab)[0x7f96e6bebaab]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/libcore-c3ca5d77d81b46c1-0.4.so(+0xb7150)[0x7f96e6c12150]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/libcore-c3ca5d77d81b46c1-0.4.so(+0x8fe00)[0x7f96e6beae00]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/libcore-c3ca5d77d81b46c1-0.4.so(+0x8f79e)[0x7f96e6bea79e]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/libcore-c3ca5d77d81b46c1-0.4.so(+0x8ee06)[0x7f96e6be9e06]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/libcore-c3ca5d77d81b46c1-0.4.so(+0x75ef4)[0x7f96e6bd0ef4]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/libcore-c3ca5d77d81b46c1-0.4.so(+0xb7150)[0x7f96e6c12150]
/home/philipp/programming/rust-git/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x24)[0x7f96e5576eb4]
RalfJung pushed a commit to RalfJung/rust that referenced this issue Jun 9, 2024
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) A-linkage Area: linking into static, shared libraries and binaries I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants