File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2174,14 +2174,23 @@ simplify_exprt::simplify_complex(const unary_exprt &expr)
2174
2174
simplify_exprt::resultt<>
2175
2175
simplify_exprt::simplify_overflow_binary (const binary_overflow_exprt &expr)
2176
2176
{
2177
- // zero is a neutral element for all operations supported here
2177
+ // When one operand is zero, an overflow can only occur for a subtraction from
2178
+ // zero.
2178
2179
if (
2179
2180
expr.op1 ().is_zero () ||
2180
2181
(expr.op0 ().is_zero () && expr.id () != ID_overflow_minus))
2181
2182
{
2182
2183
return false_exprt{};
2183
2184
}
2184
2185
2186
+ // One is neutral element for multiplication
2187
+ if (
2188
+ expr.id () == ID_overflow_mult &&
2189
+ (expr.op0 ().is_one () || expr.op1 ().is_one ()))
2190
+ {
2191
+ return false_exprt{};
2192
+ }
2193
+
2185
2194
// we only handle the case of same operand types
2186
2195
if (expr.op0 ().type () != expr.op1 ().type ())
2187
2196
return unchanged (expr);
You can’t perform that action at this time.
0 commit comments