The right hand side of a shift operation must be of integer type and do the integer promotion and nothing else. More precisely, the RHS and the LFS type doesn't need to match. This is correctly done for plain shifts but not for shift-assigns where the full usual conversion is wrongly applied. Fix this by special casing shifts in evaluate_assign_op() and just apply the integer promotion on the RHS, like done for shifts in evaluate_binop(). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- evaluate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/evaluate.c b/evaluate.c index 194b97218..7ab7db816 100644 --- a/evaluate.c +++ b/evaluate.c @@ -1325,6 +1325,11 @@ static int evaluate_assign_op(struct expression *expr) goto Cast; if (!restricted_value(expr->right, t)) return 1; + } else if (op == SPECIAL_SHR_ASSIGN || op == SPECIAL_SHL_ASSIGN) { + // shifts do integer promotions, but that's it. + unrestrict(expr->right, sclass, &s); + target = integer_promotion(s); + goto Cast; } else if (!(sclass & TYPE_RESTRICT)) goto usual; /* source and target would better be identical restricted */ -- 2.18.0 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html