Print this page
11506 smatch resync

@@ -161,11 +161,11 @@
         struct expression *left, *array;
         struct range_list *orig_rl, *rl;
         struct symbol *type;
         char *name;
 
-        type = get_type(expr->right);
+        type = get_type(expr->left);
         if (!type || type->type != SYM_BASETYPE)
                 return;
 
         left = strip_expr(expr->left);
         if (!is_array(left))

@@ -174,11 +174,12 @@
         name = get_array_name(array);
         if (!name)
                 return;
 
         if (expr->op != '=') {
-                rl = alloc_whole_rl(type);
+                rl = alloc_whole_rl(get_type(expr->right));
+                rl = cast_rl(type, rl);
         } else {
                 get_absolute_rl(expr->right, &rl);
                 rl = cast_rl(type, rl);
                 orig_rl = get_saved_rl(type, name);
                 rl = rl_union(orig_rl, rl);