File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1639,6 +1639,21 @@ simplify_exprt::resultt<> simplify_exprt::simplify_inequality_rhs_is_constant(
1639
1639
new_expr.op1 ().type () = new_expr.op0 ().type ();
1640
1640
return changed (simplify_inequality (new_expr)); // do again!
1641
1641
}
1642
+ else if (expr.op0 ().id () == ID_plus)
1643
+ {
1644
+ // NULL + 1 == NULL is false
1645
+ const plus_exprt &plus = to_plus_expr (expr.op0 ());
1646
+ if (
1647
+ plus.operands ().size () == 2 && plus.op0 ().is_constant () &&
1648
+ plus.op1 ().is_constant () &&
1649
+ ((is_null_pointer (to_constant_expr (plus.op0 ())) &&
1650
+ !plus.op1 ().is_zero ()) ||
1651
+ (is_null_pointer (to_constant_expr (plus.op1 ())) &&
1652
+ !plus.op0 ().is_zero ())))
1653
+ {
1654
+ return false_exprt ();
1655
+ }
1656
+ }
1642
1657
}
1643
1658
1644
1659
// all we are doing with pointers
You can’t perform that action at this time.
0 commit comments