@@ -14,7 +14,7 @@ use rustc_middle::mir;
1414use rustc_middle:: ty:: {
1515 self ,
1616 layout:: { IntegerExt as _, LayoutOf , TyAndLayout } ,
17- List , Ty , TyCtxt ,
17+ Ty , TyCtxt ,
1818} ;
1919use rustc_span:: { def_id:: CrateNum , sym, Span , Symbol } ;
2020use rustc_target:: abi:: { Align , FieldIdx , FieldsShape , Integer , Size , Variants } ;
@@ -282,13 +282,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
282282 Ok ( ptr. addr ( ) . bytes ( ) == 0 )
283283 }
284284
285- /// Get the `Place` for a local
286- fn local_place ( & self , local : mir:: Local ) -> InterpResult < ' tcx , PlaceTy < ' tcx , Provenance > > {
287- let this = self . eval_context_ref ( ) ;
288- let place = mir:: Place { local, projection : List :: empty ( ) } ;
289- this. eval_place ( place)
290- }
291-
292285 /// Generate some random bytes, and write them to `dest`.
293286 fn gen_random ( & mut self , ptr : Pointer < Option < Provenance > > , len : u64 ) -> InterpResult < ' tcx > {
294287 // Some programs pass in a null pointer and a length of 0
@@ -350,17 +343,21 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
350343 // Initialize arguments.
351344 let mut callee_args = this. frame ( ) . body . args_iter ( ) ;
352345 for arg in args {
353- let callee_arg = this. local_place (
354- callee_args
355- . next ( )
356- . ok_or_else ( || err_ub_format ! ( "callee has fewer arguments than expected" ) ) ?,
357- ) ?;
346+ let local = callee_args
347+ . next ( )
348+ . ok_or_else ( || err_ub_format ! ( "callee has fewer arguments than expected" ) ) ?;
349+ // Make the local live, and insert the initial value.
350+ this. storage_live ( local) ?;
351+ let callee_arg = this. local_to_place ( this. frame_idx ( ) , local) ?;
358352 this. write_immediate ( * arg, & callee_arg) ?;
359353 }
360354 if callee_args. next ( ) . is_some ( ) {
361355 throw_ub_format ! ( "callee has more arguments than expected" ) ;
362356 }
363357
358+ // Initialize remaining locals.
359+ this. storage_live_for_always_live_locals ( ) ?;
360+
364361 Ok ( ( ) )
365362 }
366363
0 commit comments