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

Remove ReadPtr hook #1189

Merged
merged 1 commit into from
Jul 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions kani-compiler/src/codegen_cprover_gotoc/overrides/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,43 +245,6 @@ impl<'tcx> GotocHook<'tcx> for Panic {
}
}

struct PtrRead;

impl<'tcx> GotocHook<'tcx> for PtrRead {
fn hook_applies(&self, tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> bool {
let name = with_no_trimmed_paths!(tcx.def_path_str(instance.def_id()));
name == "core::ptr::read"
|| name == "core::ptr::read_unaligned"
|| name == "core::ptr::read_volatile"
|| name == "std::ptr::read"
|| name == "std::ptr::read_unaligned"
|| name == "std::ptr::read_volatile"
}

fn handle(
&self,
tcx: &mut GotocCtx<'tcx>,
_instance: Instance<'tcx>,
mut fargs: Vec<Expr>,
assign_to: Place<'tcx>,
target: Option<BasicBlock>,
span: Option<Span>,
) -> Stmt {
let loc = tcx.codegen_span_option(span);
let target = target.unwrap();
let src = fargs.remove(0);
Stmt::block(
vec![
unwrap_or_return_codegen_unimplemented_stmt!(tcx, tcx.codegen_place(&assign_to))
.goto_expr
.assign(src.dereference().with_location(loc), loc),
Stmt::goto(tcx.current_fn().find_label(&target), loc),
],
loc,
)
}
}

struct RustAlloc;
// Removing this hook causes regression failures.
// https://github.com/model-checking/kani/issues/1170
Expand Down Expand Up @@ -362,7 +325,6 @@ pub fn fn_hooks<'tcx>() -> GotocHooks<'tcx> {
Rc::new(Assert),
Rc::new(ExpectFail),
Rc::new(Nondet),
Rc::new(PtrRead),
Rc::new(RustAlloc),
Rc::new(SliceFromRawPart),
],
Expand Down