From: Dan Carpenter Date: Thu, 7 Feb 2013 06:52:12 +0000 (+0300) Subject: math: handle MOD operation better X-Git-Tag: 1.57~3 X-Git-Url: https://repo.or.cz/w/smatch.git/commitdiff_plain/72a9d77a410d1bd5870258ba5b6a736d5f88c6a1 math: handle MOD operation better For implied_min and implied_max we should pretty much only look at the right side. We could look at the left, but it's a bit of code to do that properly. If we want only one value then we need to look at the left side. Signed-off-by: Dan Carpenter --- diff --git a/smatch_math.c b/smatch_math.c index 08050c43..2805b4a7 100644 --- a/smatch_math.c +++ b/smatch_math.c @@ -258,13 +258,12 @@ static sval_t handle_mod(struct expression *expr, int *undefined, int implied) return bogus; } - left = _get_value(expr->left, undefined, implied); - if (!*undefined) - return sval_binop(left, '%', right); - switch (implied) { case NOTIMPLIED: case IMPLIED: + left = _get_value(expr->left, undefined, implied); + if (!*undefined) + return sval_binop(left, '%', right); return bogus; case IMPLIED_MIN: case FUZZY_MIN: