File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
kani-compiler/src/codegen_cprover_gotoc/overrides Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -387,13 +387,22 @@ impl<'tcx> GotocHook<'tcx> for PtrRead {
387
387
let p = assign_to. unwrap ( ) ;
388
388
let target = target. unwrap ( ) ;
389
389
let src = fargs. remove ( 0 ) ;
390
+
391
+ let dst_goto =
392
+ unwrap_or_return_codegen_unimplemented_stmt ! ( tcx, tcx. codegen_place( & p) ) . goto_expr ;
393
+ let size_expr = dst_goto. typ ( ) . sizeof_expr ( & tcx. symbol_table ) ;
394
+ let memcpy = BuiltinFn :: Memcpy
395
+ . call (
396
+ vec ! [
397
+ dst_goto. address_of( ) . cast_to( Type :: void_pointer( ) ) ,
398
+ src. cast_to( Type :: void_pointer( ) ) ,
399
+ size_expr,
400
+ ] ,
401
+ loc,
402
+ )
403
+ . as_stmt ( loc) ;
390
404
Stmt :: block (
391
- vec ! [
392
- unwrap_or_return_codegen_unimplemented_stmt!( tcx, tcx. codegen_place( & p) )
393
- . goto_expr
394
- . assign( src. dereference( ) . with_location( loc. clone( ) ) , loc. clone( ) ) ,
395
- Stmt :: goto( tcx. current_fn( ) . find_label( & target) , loc. clone( ) ) ,
396
- ] ,
405
+ vec ! [ memcpy, Stmt :: goto( tcx. current_fn( ) . find_label( & target) , loc. clone( ) ) ] ,
397
406
loc,
398
407
)
399
408
}
You can’t perform that action at this time.
0 commit comments