From 664706662ff1221e88e70dd5c6ceef391e2528a6 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 16 Aug 2020 17:16:53 +0200 Subject: [PATCH] adjust diagnostics to alignment check mode --- src/diagnostics.rs | 7 ++++--- src/machine.rs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/diagnostics.rs b/src/diagnostics.rs index eed60c2696e..81cd0492172 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -100,11 +100,12 @@ pub fn report_error<'tcx, 'mir>( panic!("Error should never be raised by Miri: {:?}", e.kind), Unsupported(_) => vec![format!("this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support")], - UndefinedBehavior(UndefinedBehaviorInfo::AlignmentCheckFailed { .. }) => + UndefinedBehavior(UndefinedBehaviorInfo::AlignmentCheckFailed { .. }) + if ecx.memory.extra.check_alignment == AlignmentCheck::Symbolic + => vec![ format!("this usually indicates that your program performed an invalid operation and caused Undefined Behavior"), - format!("but alignment errors can also be false positives, see https://github.com/rust-lang/miri/issues/1074"), - format!("you can disable the alignment check with `-Zmiri-disable-alignment-check`, but that could hide true bugs") + format!("but due to `-Zmiri-symbolic-alignment-check`, alignment errors can also be false positives"), ], UndefinedBehavior(_) => vec![ diff --git a/src/machine.rs b/src/machine.rs index f2abb2ae0e7..b76159694d8 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -128,7 +128,7 @@ pub struct MemoryExtra { tracked_alloc_id: Option, /// Controls whether alignment of memory accesses is being checked. - check_alignment: AlignmentCheck, + pub(crate) check_alignment: AlignmentCheck, } impl MemoryExtra {