Skip to content

Commit

Permalink
Workaround for issue #95
Browse files Browse the repository at this point in the history
  • Loading branch information
nchong-at-aws committed Apr 27, 2021
1 parent 8f6e668 commit a2f83f9
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion compiler/rustc_codegen_llvm/src/gotoc/cbmc/goto_program/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use self::StmtBody::*;
use super::{BuiltinFn, Expr, Location};
use std::fmt::Debug;
use tracing::debug;

///////////////////////////////////////////////////////////////////////////////////////////////
/// Datatypes
Expand Down Expand Up @@ -150,7 +151,21 @@ macro_rules! stmt {
impl Stmt {
/// `lhs = rhs;`
pub fn assign(lhs: Expr, rhs: Expr, loc: Location) -> Self {
assert_eq!(lhs.typ(), rhs.typ());
//Temporarily work around https://github.com/model-checking/rmc/issues/95
//by disabling the assert and soundly assigning nondet
//assert_eq!(lhs.typ(), rhs.typ());
if lhs.typ() != rhs.typ() {
debug!(
"WARNING: assign statement with unequal types lhs {:?} rhs {:?}",
lhs.typ(),
rhs.typ()
);
let assert_stmt =
Stmt::assert_false("Reached assignment statement with unequal types", loc.clone());
let nondet_value = lhs.typ().nondet();
let nondet_assign_stmt = stmt!(Assign { lhs, rhs: nondet_value }, loc.clone());
return Stmt::block(vec![assert_stmt, nondet_assign_stmt]);
}
stmt!(Assign { lhs, rhs }, loc)
}

Expand Down

0 comments on commit a2f83f9

Please sign in to comment.