From e0e1bd7ff778e5913b566c9e03224faecc0eb486 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Mon, 7 May 2018 18:03:28 +0200 Subject: [PATCH] Pointers must be valid, even pointers to zsts --- miri/lib.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/miri/lib.rs b/miri/lib.rs index 5818a2708504..dce31c4ed338 100644 --- a/miri/lib.rs +++ b/miri/lib.rs @@ -145,7 +145,7 @@ pub fn eval_main<'a, 'tcx: 'a>( main_instance, main_mir.span, main_mir, - Place::undef(), + Place::from_primval_ptr(PrimVal::Bytes(1).into(), ty::layout::Align::from_bytes(1, 1).unwrap()), StackPopCleanup::None, )?; @@ -177,6 +177,16 @@ pub fn eval_main<'a, 'tcx: 'a>( Err(mut e) => { ecx.tcx.sess.err(&e.to_string()); ecx.report(&mut e, true, None); + for (i, frame) in ecx.stack().iter().enumerate() { + trace!("-------------------"); + trace!("Frame {}", i); + trace!(" return: {:#?}", frame.return_place); + for (i, local) in frame.locals.iter().enumerate() { + if let Some(local) = local { + trace!(" local {}: {:?}", i, local); + } + } + } } } }