From b260999d4cfd261ce077b1093c61eea7bd6faf57 Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Wed, 13 Jun 2012 16:24:15 -0400 Subject: [PATCH] [release-branch.go1] cmd/cc: fix uint right shift in constant evaluation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ««« backport aa2d2fa1e5a9 cmd/cc: fix uint right shift in constant evaluation Fixes #3664. R=golang-dev, bradfitz, rsc CC=golang-dev https://golang.org/cl/6249048 »»» --- src/cmd/cc/scon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cmd/cc/scon.c b/src/cmd/cc/scon.c index 193331f774d..f6031a5be7e 100644 --- a/src/cmd/cc/scon.c +++ b/src/cmd/cc/scon.c @@ -175,7 +175,10 @@ evconst(Node *n) break; case OLSHR: - v = (uvlong)l->vconst >> r->vconst; + if(l->type->width != sizeof(uvlong)) + v = ((uvlong)l->vconst & 0xffffffffULL) >> r->vconst; + else + v = (uvlong)l->vconst >> r->vconst; break; case OASHR: