aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/evaluate.c
diff options
context:
space:
mode:
Diffstat (limited to 'evaluate.c')
-rw-r--r--evaluate.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/evaluate.c b/evaluate.c
index 6d8ecd7f..a9adc72f 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -1348,6 +1348,11 @@ static int evaluate_assign_op(struct expression *expr)
unrestrict(expr->right, sclass, &s);
source = integer_promotion(s);
expr->right = cast_to(expr->right, source);
+
+ // both gcc & clang seems to do this, so ...
+ if (target->bit_size > source->bit_size)
+ expr->right = cast_to(expr->right, &uint_ctype);
+
goto Cast;
} else if (!(sclass & TYPE_RESTRICT))
goto usual;