From 03ae4fa162221c0828e273fa2fe57d0347ef0f15 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Thu, 28 Feb 2013 19:23:54 +0100 Subject: 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. --- sys/src/cmd/6c/cgen.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/src/cmd/6c/cgen.c b/sys/src/cmd/6c/cgen.c index 5e6b10b33..6b1e94185 100644 --- a/sys/src/cmd/6c/cgen.c +++ b/sys/src/cmd/6c/cgen.c @@ -1596,7 +1596,7 @@ copy: 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 @@ copy: 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 @@ copy: 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 @@ warn(Z, "DI botch"); 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 @@ warn(Z, "DI botch"); 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); -- cgit v1.2.3