A MIR transform that checks pointers are aligned
This commit is contained in:
parent
e216300876
commit
8ccf53332e
34 changed files with 360 additions and 20 deletions
|
@ -379,6 +379,18 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
|
|||
source_info.span,
|
||||
);
|
||||
}
|
||||
AssertKind::MisalignedPointerDereference { ref required, ref found } => {
|
||||
let required = codegen_operand(fx, required).load_scalar(fx);
|
||||
let found = codegen_operand(fx, found).load_scalar(fx);
|
||||
let location = fx.get_caller_location(source_info).load_scalar(fx);
|
||||
|
||||
codegen_panic_inner(
|
||||
fx,
|
||||
rustc_hir::LangItem::PanicBoundsCheck,
|
||||
&[required, found, location],
|
||||
source_info.span,
|
||||
);
|
||||
}
|
||||
_ => {
|
||||
let msg_str = msg.description();
|
||||
codegen_panic(fx, msg_str, source_info);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue