sval: type: hack select types
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 19 Nov 2012 14:35:46 +0000 (19 17:35 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Mon, 19 Nov 2012 18:47:47 +0000 (19 21:47 +0300)
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 <dan.carpenter@oracle.com>
smatch_type.c

index 020129a..3cc6d67 100644 (file)
@@ -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)