summaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-10-15 16:32:45 -0700
committerRuss Cox <rsc@golang.org>2009-10-15 16:32:45 -0700
commitd8bbdc0b283b4324ec7df08e41514e37c0f1d842 (patch)
tree59d3eb13285d32a955bf6127a98d1b888a695a53 /src/cmd
parentd029c2791e03b33531e24e4abaaa6b3317e50f55 (diff)
downloadgolang-d8bbdc0b283b4324ec7df08e41514e37c0f1d842.tar.gz
386 shift bug; wasn't zero-extending 16- and 8-bit counts
+test R=ken OCL=35801 CL=35801
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/8g/cgen64.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/cmd/8g/cgen64.c b/src/cmd/8g/cgen64.c
index f89cbab7d..6b3dae65a 100644
--- a/src/cmd/8g/cgen64.c
+++ b/src/cmd/8g/cgen64.c
@@ -178,8 +178,10 @@ cgen64(Node *n, Node *res)
gins(ACMPL, &hi2, ncon(0));
p1 = gbranch(AJNE, T);
gins(AMOVL, &lo2, &cx);
- } else
- gins(AMOVL, r, &cx);
+ } else {
+ cx.type = types[TUINT32];
+ gmove(r, &cx);
+ }
// if shift count is >=64, zero value
gins(ACMPL, &cx, ncon(64));
@@ -265,8 +267,10 @@ cgen64(Node *n, Node *res)
gins(ACMPL, &hi2, ncon(0));
p1 = gbranch(AJNE, T);
gins(AMOVL, &lo2, &cx);
- } else
- gins(AMOVL, r, &cx);
+ } else {
+ cx.type = types[TUINT32];
+ gmove(r, &cx);
+ }
// if shift count is >=64, zero or sign-extend value
gins(ACMPL, &cx, ncon(64));