From 159b0ac23ba1f96cd30b120124d41528a562a5cc Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 23 Nov 2012 14:21:52 +0300 Subject: [PATCH] extra: get max correctly The original code only took known values or the type max but the intent was to use the implied max or the type max. Signed-off-by: Dan Carpenter --- smatch_extra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smatch_extra.c b/smatch_extra.c index ba8da2c5..50c3c118 100644 --- a/smatch_extra.c +++ b/smatch_extra.c @@ -220,7 +220,7 @@ static struct sm_state *handle_canonical_for_inc(struct expression *iter_expr, return NULL; if (!estate_get_single_value(sm->state, &start)) return NULL; - if (!get_implied_value(condition->right, &end)) + if (!get_implied_max(condition->right, &end)) end = sval_type_max(get_type(iter_var)); if (get_sm_state_expr(SMATCH_EXTRA, condition->left) != sm) @@ -260,7 +260,7 @@ static struct sm_state *handle_canonical_for_dec(struct expression *iter_expr, return NULL; if (!estate_get_single_value(sm->state, &start)) return NULL; - if (!get_implied_value(condition->right, &end)) + if (!get_implied_min(condition->right, &end)) end = sval_type_min(get_type(iter_var)); if (get_sm_state_expr(SMATCH_EXTRA, condition->left) != sm) return NULL; -- 2.11.4.GIT