File tree 1 file changed +22
-1
lines changed
compiler/rustc_codegen_llvm/src/gotoc/cbmc/goto_program
1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 3
3
use self :: StmtBody :: * ;
4
4
use super :: { BuiltinFn , Expr , Location } ;
5
5
use std:: fmt:: Debug ;
6
+ use tracing:: debug;
6
7
7
8
///////////////////////////////////////////////////////////////////////////////////////////////
8
9
/// Datatypes
@@ -150,7 +151,27 @@ macro_rules! stmt {
150
151
impl Stmt {
151
152
/// `lhs = rhs;`
152
153
pub fn assign ( lhs : Expr , rhs : Expr , loc : Location ) -> Self {
153
- assert_eq ! ( lhs. typ( ) , rhs. typ( ) ) ;
154
+ //Temporarily work around https://github.com/model-checking/rmc/issues/95
155
+ //by disabling the assert and soundly assigning nondet
156
+ //assert_eq!(lhs.typ(), rhs.typ());
157
+ if lhs. typ ( ) != rhs. typ ( ) {
158
+ debug ! (
159
+ "WARNING: assign statement with unequal types lhs {:?} rhs {:?}" ,
160
+ lhs. typ( ) ,
161
+ rhs. typ( )
162
+ ) ;
163
+ let assert_stmt = Stmt :: assert_false (
164
+ & format ! (
165
+ "Reached assignment statement with unequal types {:?} {:?}" ,
166
+ lhs. typ( ) ,
167
+ rhs. typ( )
168
+ ) ,
169
+ loc. clone ( ) ,
170
+ ) ;
171
+ let nondet_value = lhs. typ ( ) . nondet ( ) ;
172
+ let nondet_assign_stmt = stmt ! ( Assign { lhs, rhs: nondet_value } , loc. clone( ) ) ;
173
+ return Stmt :: block ( vec ! [ assert_stmt, nondet_assign_stmt] ) ;
174
+ }
154
175
stmt ! ( Assign { lhs, rhs } , loc)
155
176
}
156
177
You can’t perform that action at this time.
0 commit comments