]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.power64] cmd/9c: fix constant truncation in optimizer
authorRuss Cox <rsc@golang.org>
Thu, 14 Aug 2014 18:34:14 +0000 (14:34 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 14 Aug 2014 18:34:14 +0000 (14:34 -0400)
This is what broke getpopcount, but that code had it coming.

LGTM=minux
R=minux
CC=golang-codereviews
https://golang.org/cl/130000044

src/cmd/9c/reg.c

index 658fa3211e991ff50968718c551142280cecb15a..38bb2e9defc96c35176cbe66f6045a711c259b7b 100644 (file)
@@ -558,7 +558,7 @@ mkvar(Addr *a, int docon)
 {
        Var *v;
        int i, t, n, et, z;
-       int32 o;
+       int64 o;
        Bits bit;
        LSym *s;
 
@@ -617,6 +617,8 @@ out:
                for(z=0; z<BITS; z++)
                        addrs.b[z] |= bit.b[z];
        if(t == D_CONST) {
+               if((int32)o != o)
+                       v->etype = TVLONG;
                if(s == nil) {
                        for(z=0; z<BITS; z++)
                                consts.b[z] |= bit.b[z];