File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
src/analyses/variable-sensitivity Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -255,19 +255,20 @@ class constants_evaluator
255255 auto lhs_value = eval_constant (op);
256256
257257 // do not give up if a sub-expression is not a constant,
258- // because the whole expression may still be simplified in some cases
259- expr.operands ().push_back (lhs_value.is_nil () ? op : lhs_value);
260- }
261-
262- exprt simplified = simplify_expr (expr, ns);
263- for (const exprt &op : simplified.operands ())
264- {
265- auto lhs_value = eval_constant (op);
266258 if (lhs_value.is_nil ())
267- return top (simplified.type ());
259+ {
260+ exprt simplified_op = simplify_expr (op, ns);
261+ if (simplified_op.is_not_nil ())
262+ lhs_value = eval_constant (simplified_op);
263+ if (lhs_value.is_nil ())
264+ return top (expr.type ());
265+ }
266+
267+ expr.operands ().push_back (lhs_value);
268268 }
269269
270270 // the expression is fully simplified
271+ exprt simplified = simplify_expr (expr, ns);
271272 return std::make_shared<constant_abstract_valuet>(
272273 simplified, environment, ns);
273274 }
You can’t perform that action at this time.
0 commit comments