File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
src/solvers/smt2_incremental Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -724,15 +724,17 @@ static smt_termt convert_expr_to_smt(
724
724
}
725
725
else if (one_operand_pointer)
726
726
{
727
- UNIMPLEMENTED_FEATURE (
728
- " convert_expr_to_smt::minus_exprt doesn't handle expressions where"
729
- " only one operand is a pointer - this is because these expressions"
730
- " are normally handled by convert_expr_to_smt::plus_exprt due to"
731
- " transformations of the expressions by previous passes bringing"
732
- " them into a form more suitably handled by that version of the function."
733
- " If you are here, this is a mistake or something went wrong before."
734
- " The expression that caused the problem is: " +
735
- minus.pretty ());
727
+ // It's semantically void to have an expression `3 - a` where `a`
728
+ // is a pointer.
729
+ INVARIANT (
730
+ lhs_is_pointer,
731
+ " minus expressions of pointer and integer expect lhs to be the pointer" );
732
+ const auto lhs_base_type = to_pointer_type (minus.lhs ().type ()).base_type ();
733
+
734
+ return smt_bit_vector_theoryt::subtract (
735
+ converted.at (minus.lhs ()),
736
+ smt_bit_vector_theoryt::multiply (
737
+ converted.at (minus.rhs ()), pointer_sizes.at (lhs_base_type)));
736
738
}
737
739
else
738
740
{
You can’t perform that action at this time.
0 commit comments