We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5c1c334 commit 51674f8Copy full SHA for 51674f8
src/solvers/smt2/smt2_conv.cpp
@@ -3587,7 +3587,19 @@ void smt2_convt::convert_minus(const minus_exprt &expr)
3587
}
3588
else if(expr.type().id()==ID_pointer)
3589
{
3590
- SMT2_TODO("pointer subtraction");
+ if(
3591
+ expr.op0().type().id() == ID_pointer &&
3592
+ (expr.op1().type().id() == ID_unsignedbv ||
3593
+ expr.op1().type().id() == ID_signedbv))
3594
+ {
3595
+ // rewrite p-o to p+(-o)
3596
+ return convert_plus(
3597
+ plus_exprt(expr.op0(), unary_minus_exprt(expr.op1())));
3598
+ }
3599
+ else
3600
+ UNEXPECTEDCASE(
3601
+ "unsupported operand types for -: " + expr.op0().type().id_string() +
3602
+ " and " + expr.op1().type().id_string());
3603
3604
else if(expr.type().id()==ID_vector)
3605
0 commit comments