From 13c9724d875d782a731c552d8c17b3dc3fe40212 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 12 Oct 2012 10:58:37 +0300 Subject: [PATCH] type: fix get_binop_type() for bit shift operations Bit shifts only depend on the left hand side. Signed-off-by: Dan Carpenter --- smatch_type.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/smatch_type.c b/smatch_type.c index 8e808a6b..0214166d 100644 --- a/smatch_type.c +++ b/smatch_type.c @@ -39,6 +39,13 @@ static struct symbol *get_binop_type(struct expression *expr) if (right->type == SYM_PTR || right->type == SYM_ARRAY) return right; + if (expr->op == SPECIAL_LEFTSHIFT || + expr->op == SPECIAL_RIGHTSHIFT) { + if (type_max(left) < type_max(&int_ctype)) + return &int_ctype; + return left; + } + if (type_max(left) < type_max(&int_ctype) && type_max(right) < type_max(&int_ctype)) return &int_ctype; -- 2.11.4.GIT