@@ -16,11 +16,12 @@ Author: Peter Schrammel
16
16
#include < util/format_expr.h>
17
17
#endif
18
18
19
- #include < util/ieee_float.h>
20
- #include < util/find_symbols.h>
21
19
#include < util/arith_tools.h>
22
- #include < util/simplify_expr .h>
20
+ #include < util/base_type .h>
23
21
#include < util/cprover_prefix.h>
22
+ #include < util/find_symbols.h>
23
+ #include < util/ieee_float.h>
24
+ #include < util/simplify_expr.h>
24
25
25
26
#include < langapi/language_util.h>
26
27
@@ -46,7 +47,12 @@ void constant_propagator_domaint::assign_rec(
46
47
partial_evaluate (tmp, ns);
47
48
48
49
if (tmp.is_constant ())
50
+ {
51
+ DATA_INVARIANT (
52
+ base_type_eq (ns.lookup (s).type , tmp.type (), ns),
53
+ " type of constant to be replaced should match" );
49
54
values.set_to (s, tmp);
55
+ }
50
56
else
51
57
values.set_to_top (s);
52
58
}
@@ -258,7 +264,7 @@ bool constant_propagator_domaint::two_way_propagate_rec(
258
264
assign_rec(copy_values, lhs, rhs, ns);
259
265
if(!values.is_constant(rhs) || values.is_constant(lhs))
260
266
assign_rec(values, rhs, lhs, ns);
261
- change= values.meet(copy_values);
267
+ change = values.meet(copy_values, ns );
262
268
}
263
269
#endif
264
270
@@ -469,7 +475,9 @@ bool constant_propagator_domaint::valuest::merge(const valuest &src)
469
475
470
476
// / meet
471
477
// / \return Return true if "this" has changed.
472
- bool constant_propagator_domaint::valuest::meet (const valuest &src)
478
+ bool constant_propagator_domaint::valuest::meet (
479
+ const valuest &src,
480
+ const namespacet &ns)
473
481
{
474
482
if (src.is_bottom || is_bottom)
475
483
return false ;
@@ -492,6 +500,9 @@ bool constant_propagator_domaint::valuest::meet(const valuest &src)
492
500
}
493
501
else
494
502
{
503
+ DATA_INVARIANT (
504
+ base_type_eq (ns.lookup (m.first ).type , m.second .type (), ns),
505
+ " type of constant to be stored should match" );
495
506
set_to (m.first , m.second );
496
507
changed=true ;
497
508
}
0 commit comments