ref: 67b7dd718edf78942229e33d9449f96015f2a06e
parent: d8d4106f3dce495c165ee5d9b1763858b9466ce2
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Thu Feb 28 14:23:54 EST 2013
6c: fix 32bit pointer truncation (from patch/6c-sugen-types) 1. Go group spotted that a slightly-obscured pointer move was done by AMOVL not AMOVQ. 2. Inspecting the code further, I noticed that other pointer types were set to TLONG not TIND, causing similar truncation of pointers to 32 bits.
--- a/sys/src/cmd/6c/cgen.c
+++ b/sys/src/cmd/6c/cgen.c
@@ -1596,7 +1596,7 @@
regsalloc(&nod2, nn);
nn->type = t;
- gins(AMOVL, &nod1, &nod2);
+ gins(AMOVQ, &nod1, &nod2);
regfree(&nod1);
nod2.type = typ(TIND, t);
@@ -1697,7 +1697,7 @@
c = 0;
if(n->complex > nn->complex) {t = n->type;
- n->type = types[TLONG];
+ n->type = types[TIND];
nodreg(&nod1, n, D_SI);
if(reg[D_SI]) {gins(APUSHQ, &nod1, Z);
@@ -1708,7 +1708,7 @@
n->type = t;
t = nn->type;
- nn->type = types[TLONG];
+ nn->type = types[TIND];
nodreg(&nod2, nn, D_DI);
if(reg[D_DI]) {warn(Z, "DI botch");
@@ -1720,7 +1720,7 @@
nn->type = t;
} else {t = nn->type;
- nn->type = types[TLONG];
+ nn->type = types[TIND];
nodreg(&nod2, nn, D_DI);
if(reg[D_DI]) {warn(Z, "DI botch");
@@ -1732,7 +1732,7 @@
nn->type = t;
t = n->type;
- n->type = types[TLONG];
+ n->type = types[TIND];
nodreg(&nod1, n, D_SI);
if(reg[D_SI]) {gins(APUSHQ, &nod1, Z);
--
⑨