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
22main.c
33--pointer-check
44^EXIT=0$
Original file line number Diff line number Diff line change 1- CORE broken-smt-backend
1+ CORE
22main.c
33--pointer-overflow-check --no-simplify
44^\[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)
36443644 element_size = *element_size_opt;
36453645 }
36463646
3647- out << " (bvadd " ;
3647+ // First convert the pointer operand
3648+ out << " (let ((?pointerop " ;
36483649 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) " ;
36503661
36513662 if (element_size >= 2 )
36523663 {
3653- out << " (bvmul " ;
3664+ out << " (bvmul ((_ extract " << offset_bits - 1 << " 0) " ;
36543665 convert_expr (i);
3655- out << " (_ bv" << element_size << " " << boolbv_width (expr.type ())
3656- << " ))" ;
3666+ out << " ) (_ bv" << element_size << " " << offset_bits << " ))" ;
36573667 }
36583668 else
3669+ {
3670+ out << " ((_ extract " << offset_bits - 1 << " 0) " ;
36593671 convert_expr (i);
3672+ out << ' )' ; // extract
3673+ }
36603674
3661- out << ' ) ' ;
3675+ out << " ))) " ; // bvadd, concat, let
36623676 }
36633677 else
36643678 {
You can’t perform that action at this time.
0 commit comments