Skip to content

Commit baa52ca

Browse files
committed
Abort creating wrapper fn for multiple inner fns
This discovers another class of mis-trans where we wrap multiple native functions into a single wrapper, which is wrong.
1 parent 2198969 commit baa52ca

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/librustc_trans/trans/foreign.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,11 @@ pub fn trans_rust_fn_with_foreign_abi<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
642642
// return r;
643643
// }
644644

645+
if llvm::LLVMCountBasicBlocks(llwrapfn) != 0 {
646+
ccx.sess().bug("wrapping a function inside non-empty wrapper, most likely cause is \
647+
multiple functions being wrapped");
648+
}
649+
645650
let ptr = "the block\0".as_ptr();
646651
let the_block = llvm::LLVMAppendBasicBlockInContext(ccx.llcx(), llwrapfn,
647652
ptr as *const _);

0 commit comments

Comments
 (0)