TomBebbington / llvm-rs

LLVM wrappers for Rust
BSD 3-Clause "New" or "Revised" License
68 stars 27 forks source link

Type checking code in `JitEngine::with_function` tends to fail with segfault. #16

Open TomBebbington opened 8 years ago

TomBebbington commented 8 years ago
#0  0x0000555555e963c0 in LLVMGetParamTypes ()
#1  0x00005555556901b2 in llvm::types::{{impl}}::get_params (
    self=0x7ffff60ba000) at /code/llvm-rs/src/types.rs:149
#2  0x000055555568a471 in llvm::engine::{{impl}}::with_function<closure,u64,u64> (self=0x7ffff609e400, function=0x7ffff60c6008, cb=...) at <std macros>:110
#3  0x0000555555689a89 in fib::main () at /code/llvm-rs/examples/fib.rs:36
#4  0x0000555555699f79 in std::panicking::try::call::h852b0d5f2eec25e4 ()
#5  0x00005555556a3b4c in __rust_try ()
#6  0x00005555556a3aef in __rust_maybe_catch_panic ()
#7  0x0000555555699a1f in std::rt::lang_start::hfe4efe1fc39e4a30 ()
#8  0x000055555568c26a in main ()

This can be worked around by adding the debug_assertions flag to rustc, or by adding --release to the cargo build flags. Also, modifying the library so it interacts with the function type in any way before calling get_params seems to fix this, so it could be some kind of null error that's slipped through.