From e0de37696e080db37989061d1856c44c8e0807da Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 9 Dec 2014 10:09:42 +0300 Subject: [PATCH] type: pointers are unsigned Before if there neither MOD_UNSIGNED nor MOD_SIGNED were set then it was treated like a signed value. This only affects pointers apparently. Now type_signed() will only return true if MOD_SIGNED is set. I needed to make a change to smatch_ranges.c as well, otherwise this lead to bugs. Signed-off-by: Dan Carpenter --- smatch_ranges.c | 1 + smatch_type.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/smatch_ranges.c b/smatch_ranges.c index 6bd27a91..17438539 100644 --- a/smatch_ranges.c +++ b/smatch_ranges.c @@ -994,6 +994,7 @@ static void add_range_t(struct symbol *type, struct range_list **rl, sval_t min, add_range(rl, min, max); } + add_range(rl, min, max); return; } diff --git a/smatch_type.c b/smatch_type.c index 6077e61c..a28430b1 100644 --- a/smatch_type.c +++ b/smatch_type.c @@ -264,9 +264,9 @@ int type_signed(struct symbol *base_type) { if (!base_type) return 0; - if (base_type->ctype.modifiers & MOD_UNSIGNED) - return 0; - return 1; + if (base_type->ctype.modifiers & MOD_SIGNED) + return 1; + return 0; } int expr_unsigned(struct expression *expr) -- 2.11.4.GIT