From: Dan Carpenter Date: Mon, 19 Nov 2012 14:35:46 +0000 (+0300) Subject: sval: type: hack select types X-Git-Tag: 1.57~188 X-Git-Url: https://repo.or.cz/w/smatch.git/commitdiff_plain/95560547275b7bf16b092c08e55e3a54c4a3e88e sval: type: hack select types We really don't know the type here, but it's probably ok to guess. If we don't then the caller is just going to use &llong_ctype anyway. Signed-off-by: Dan Carpenter --- diff --git a/smatch_type.c b/smatch_type.c index 020129a8..3cc6d67a 100644 --- a/smatch_type.c +++ b/smatch_type.c @@ -147,9 +147,14 @@ static struct symbol *get_select_type(struct expression *expr) two = get_type(expr->cond_false); if (!one || !two) return NULL; - if (types_equiv(one, two)) + /* + * This is a hack. If the types are not equiv then we + * really don't know the type. But I think guessing is + * probably Ok here. + */ + if (type_positive_bits(one) > type_positive_bits(two)) return one; - return NULL; + return two; } struct symbol *get_pointer_type(struct expression *expr)