@@ -33,11 +33,12 @@ impl<'tcx> GotocCtx<'tcx> {
33
33
place : & Place ,
34
34
mut fargs : Vec < Expr > ,
35
35
f : F ,
36
+ loc : Location ,
36
37
) -> Stmt {
37
38
let arg1 = fargs. remove ( 0 ) ;
38
39
let arg2 = fargs. remove ( 0 ) ;
39
40
let expr = f ( arg1, arg2) ;
40
- self . codegen_expr_to_place_stable ( place, expr, Location :: none ( ) )
41
+ self . codegen_expr_to_place_stable ( place, expr, loc )
41
42
}
42
43
43
44
/// Given a call to an compiler intrinsic, generate the call and the `goto` terminator
@@ -178,7 +179,7 @@ impl<'tcx> GotocCtx<'tcx> {
178
179
179
180
// Intrinsics which encode a simple binary operation
180
181
macro_rules! codegen_intrinsic_binop {
181
- ( $f: ident) => { { self . binop( place, fargs, |a, b| a. $f( b) ) } } ;
182
+ ( $f: ident) => { { self . binop( place, fargs, |a, b| a. $f( b) , loc ) } } ;
182
183
}
183
184
184
185
// Intrinsics which encode a simple binary operation which need a machine model
@@ -208,7 +209,7 @@ impl<'tcx> GotocCtx<'tcx> {
208
209
let alloc = stable_instance. try_const_eval( place_ty) . unwrap( ) ;
209
210
// We assume that the intrinsic has type checked at this point, so
210
211
// we can use the place type as the expression type.
211
- let expr = self . codegen_allocation( & alloc, place_ty, Some ( span ) ) ;
212
+ let expr = self . codegen_allocation( & alloc, place_ty, loc ) ;
212
213
self . codegen_expr_to_place_stable( & place, expr, loc)
213
214
} } ;
214
215
}
@@ -727,7 +728,7 @@ impl<'tcx> GotocCtx<'tcx> {
727
728
let res = self . codegen_binop_with_overflow ( binop, left, right, result_type. clone ( ) , loc) ;
728
729
self . codegen_expr_to_place_stable (
729
730
place,
730
- Expr :: statement_expression ( vec ! [ res. as_stmt( loc) ] , result_type) ,
731
+ Expr :: statement_expression ( vec ! [ res. as_stmt( loc) ] , result_type, loc ) ,
731
732
loc,
732
733
)
733
734
}
@@ -1042,9 +1043,11 @@ impl<'tcx> GotocCtx<'tcx> {
1042
1043
let is_lhs_ok = lhs_var. clone ( ) . is_nonnull ( ) ;
1043
1044
let is_rhs_ok = rhs_var. clone ( ) . is_nonnull ( ) ;
1044
1045
let should_skip_pointer_checks = is_len_zero. and ( is_lhs_ok) . and ( is_rhs_ok) ;
1045
- let place_expr =
1046
- unwrap_or_return_codegen_unimplemented_stmt ! ( self , self . codegen_place_stable( place) )
1047
- . goto_expr ;
1046
+ let place_expr = unwrap_or_return_codegen_unimplemented_stmt ! (
1047
+ self ,
1048
+ self . codegen_place_stable( place, loc)
1049
+ )
1050
+ . goto_expr ;
1048
1051
let res = should_skip_pointer_checks. ternary (
1049
1052
Expr :: int_constant ( 0 , place_expr. typ ( ) . clone ( ) ) , // zero bytes are always equal (as long as pointers are nonnull and aligned)
1050
1053
BuiltinFn :: Memcmp
@@ -1634,7 +1637,7 @@ impl<'tcx> GotocCtx<'tcx> {
1634
1637
loc,
1635
1638
)
1636
1639
} else {
1637
- self . binop ( p, fargs, op_fun)
1640
+ self . binop ( p, fargs, op_fun, loc )
1638
1641
}
1639
1642
}
1640
1643
0 commit comments