From 8fa8b3bec8abbe3ea202f9bc0615fafe5002d241 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 19 Nov 2012 23:02:40 +0300 Subject: [PATCH] sval: math: fix get_value() for !foo handle_negate() was only checking the implied values, not the known values. Signed-off-by: Dan Carpenter --- smatch_math.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/smatch_math.c b/smatch_math.c index b88980b5..355d294c 100644 --- a/smatch_math.c +++ b/smatch_math.c @@ -101,6 +101,17 @@ static sval_t handle_negate(struct expression *expr, int *undefined, int implied sval_t ret; ret = sval_blank(expr->unop); + + if (known_condition_true(expr->unop)) { + ret.value = 0; + return ret; + } + + if (implied == NOTIMPLIED) { + *undefined = 1; + return bogus; + } + if (implied_condition_true(expr->unop)) { ret.value = 0; return ret; -- 2.11.4.GIT