From 3bb914c8b4724fce6f6ef53573b5d5df23030a05 Mon Sep 17 00:00:00 2001 From: Alexey Frunze Date: Sat, 13 Dec 2014 01:06:53 -0800 Subject: [PATCH] Fix >>= >>= should be unsigned when the left operand is unsigned int. The right operand isn't important here. --- src/cmd/smlrc/smlrc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cmd/smlrc/smlrc.c b/src/cmd/smlrc/smlrc.c index febe8c8..a62e0b1 100644 --- a/src/cmd/smlrc/smlrc.c +++ b/src/cmd/smlrc/smlrc.c @@ -3797,7 +3797,7 @@ int exprval(int* idx, int* ExprTypeSynPtr, int* ConstExpr) } if (SyntaxStack[*ExprTypeSynPtr][0] == tokUnsigned && tok == tokRShift) - stack[oldIdxRight + 1 - (oldSpRight - sp)][0] = tokURShift; + stack[oldIdxRight + 1 - (oldSpRight - sp)][0] = tokURShift; // ignore RightExprTypeSynPtr for the purpose of promotion/conversion of the result of <> RightExprTypeSynPtr = SymIntSynPtr; @@ -4215,10 +4215,12 @@ int exprval(int* idx, int* ExprTypeSynPtr, int* ConstExpr) { case tokAssignDiv: t = tokAssignUDiv; break; case tokAssignMod: t = tokAssignUMod; break; - case tokAssignRSh: t = tokAssignURSh; break; + case tokAssignRSh: + if (SyntaxStack[*ExprTypeSynPtr][0] == tokUnsigned) + t = tokAssignURSh; + break; } - if (t != tok) - stack[oldIdxRight + 1 - (oldSpRight - sp)][0] = t; + stack[oldIdxRight + 1 - (oldSpRight - sp)][0] = t; } *ConstExpr = 0; @@ -8152,4 +8154,3 @@ int main(int argc, char** argv) return 0; } -