File tree Expand file tree Collapse file tree 3 files changed +22
-8
lines changed Expand file tree Collapse file tree 3 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 1
- CORE broken-smt-backend
1
+ CORE
2
2
main.c
3
3
--pointer-check
4
4
^EXIT=0$
Original file line number Diff line number Diff line change 1
- CORE broken-smt-backend
1
+ CORE
2
2
main.c
3
3
--pointer-overflow-check --no-simplify
4
4
^\[main.pointer_arithmetic.\d+\] line 6 pointer arithmetic: pointer outside object bounds in p \+ \(signed (long (long )?)?int\)10: FAILURE
Original file line number Diff line number Diff line change @@ -3644,21 +3644,35 @@ void smt2_convt::convert_plus(const plus_exprt &expr)
3644
3644
element_size = *element_size_opt;
3645
3645
}
3646
3646
3647
- out << " (bvadd " ;
3647
+ // First convert the pointer operand
3648
+ out << " (let ((?pointerop " ;
3648
3649
convert_expr (p);
3649
- out << " " ;
3650
+ out << " )) " ;
3651
+
3652
+ // The addition is done on the offset part only.
3653
+ const std::size_t pointer_width = boolbv_width (p.type ());
3654
+ const std::size_t offset_bits =
3655
+ pointer_width - config.bv_encoding .object_bits ;
3656
+
3657
+ out << " (concat " ;
3658
+ out << " ((_ extract " << pointer_width - 1 << ' ' << offset_bits
3659
+ << " ) ?pointerop) " ;
3660
+ out << " (bvadd ((_ extract " << offset_bits - 1 << " 0) ?pointerop) " ;
3650
3661
3651
3662
if (element_size >= 2 )
3652
3663
{
3653
- out << " (bvmul " ;
3664
+ out << " (bvmul ((_ extract " << offset_bits - 1 << " 0) " ;
3654
3665
convert_expr (i);
3655
- out << " (_ bv" << element_size << " " << boolbv_width (expr.type ())
3656
- << " ))" ;
3666
+ out << " ) (_ bv" << element_size << " " << offset_bits << " ))" ;
3657
3667
}
3658
3668
else
3669
+ {
3670
+ out << " ((_ extract " << offset_bits - 1 << " 0) " ;
3659
3671
convert_expr (i);
3672
+ out << ' )' ; // extract
3673
+ }
3660
3674
3661
- out << ' ) ' ;
3675
+ out << " ))) " ; // bvadd, concat, let
3662
3676
}
3663
3677
else
3664
3678
{
You can’t perform that action at this time.
0 commit comments