miri: Detect uninitialized integers and floats
Change the Miri engine to allow configuring whether to check initialization of integers and floats. This allows the Miri tool to optionally check for initialization if requested by the user.
This commit is contained in:
parent
00d5e42e77
commit
d8a1454dd8
2 changed files with 12 additions and 5 deletions
|
@ -131,6 +131,10 @@ pub trait Machine<'mir, 'tcx>: Sized {
|
|||
/// Whether to enforce the validity invariant
|
||||
fn enforce_validity(ecx: &InterpCx<'mir, 'tcx, Self>) -> bool;
|
||||
|
||||
/// Whether to enforce validity (e.g., initialization and not having ptr provenance)
|
||||
/// of integers and floats.
|
||||
fn enforce_number_validity(ecx: &InterpCx<'mir, 'tcx, Self>) -> bool;
|
||||
|
||||
/// Whether function calls should be [ABI](Abi)-checked.
|
||||
fn enforce_abi(_ecx: &InterpCx<'mir, 'tcx, Self>) -> bool {
|
||||
true
|
||||
|
@ -426,6 +430,11 @@ pub macro compile_time_machine(<$mir: lifetime, $tcx: lifetime>) {
|
|||
false // for now, we don't enforce validity
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn enforce_number_validity(_ecx: &InterpCx<$mir, $tcx, Self>) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn call_extra_fn(
|
||||
_ecx: &mut InterpCx<$mir, $tcx, Self>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue