From: Dan Carpenter Date: Fri, 23 Nov 2012 11:21:52 +0000 (+0300) Subject: extra: get max correctly X-Git-Tag: 1.57~161 X-Git-Url: https://repo.or.cz/w/smatch.git/commitdiff_plain/159b0ac23ba1f96cd30b120124d41528a562a5cc 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 --- 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;