conditions: preserve the type in select assignments
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 23 Nov 2012 06:35:32 +0000 (23 09:35 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Fri, 23 Nov 2012 06:35:32 +0000 (23 09:35 +0300)
The original code made everything long long one or long long zero.

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

index 5ea8da4..45307a2 100644 (file)
@@ -471,7 +471,9 @@ int __handle_condition_assigns(struct expression *expr)
           on the big_expression_stack.  */
        push_expression(&big_expression_stack, right);
        split_conditions(right);
-       set_true_false_states_expr(SMATCH_EXTRA, expr->left, alloc_estate(ll_to_sval(1)), alloc_estate(ll_to_sval(0)));
+       set_true_false_states_expr(SMATCH_EXTRA, expr->left,
+                                  alloc_estate(sval_type_val(get_type(expr->left), 1)),
+                                  alloc_estate(sval_type_val(get_type(expr->left), 0)));
        __use_cond_states();
        __pass_to_client(right, WHOLE_CONDITION_HOOK);
        pop_expression(&big_expression_stack);