extra: type bug handling asm expressions
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 15 Mar 2013 20:04:19 +0000 (15 23:04 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Fri, 15 Mar 2013 20:04:19 +0000 (15 23:04 +0300)
This is a theoretical bug more than anything.  If the variable is casted
then we care about the uncasted type more than the casted version.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_extra.c

index e476901..293b18a 100644 (file)
@@ -662,6 +662,7 @@ static void asm_expr(struct statement *stmt)
 {
 
        struct expression *expr;
+       struct symbol *type;
        int state = 0;
 
        FOR_EACH_PTR(stmt->asm_outputs, expr) {
@@ -672,7 +673,8 @@ static void asm_expr(struct statement *stmt)
                        continue;
                case 2: /* expression */
                        state = 0;
-                       set_extra_expr_mod(expr, alloc_estate_whole(get_type(expr)));
+                       type = get_type(strip_expr(expr));
+                       set_extra_expr_mod(expr, alloc_estate_whole(type));
                        continue;
                }
        } END_FOR_EACH_PTR(expr);