]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/6c, cmd/6g, cmd/cc: fix undefined behavior warnings
authorDave Cheney <dave@cheney.net>
Tue, 17 Sep 2013 03:43:27 +0000 (13:43 +1000)
committerDave Cheney <dave@cheney.net>
Tue, 17 Sep 2013 03:43:27 +0000 (13:43 +1000)
Update #5764

Like Tribbles, the more you kill, the more spring up in their place.

R=rsc
CC=golang-dev
https://golang.org/cl/13324049

src/cmd/6c/sgen.c
src/cmd/6g/ggen.c
src/cmd/cc/scon.c

index fdba0be2294ff4f18002ed17fc6ad2e796cac52f..744a60222cd3478c0eaf92d9df35e78a888ba017 100644 (file)
@@ -36,7 +36,7 @@ gtext(Sym *s, int32 stkoff)
 {
        vlong v;
 
-       v = (argsize() << 32) | (stkoff & 0xffffffff);
+       v = ((uvlong)argsize() << 32) | (stkoff & 0xffffffff);
        if((textflag & NOSPLIT) && stkoff >= 128)
                yyerror("stack frame too large for NOSPLIT function");
 
index 1e1790e1221eff65142e12840ccdae47377f0152..6f4c84704a98f100eb84fc3af0f6ae82b0b868bd 100644 (file)
@@ -596,7 +596,7 @@ dodiv(int op, Node *nl, Node *nr, Node *res)
        check = 0;
        if(issigned[t->etype]) {
                check = 1;
-               if(isconst(nl, CTINT) && mpgetfix(nl->val.u.xval) != -1LL<<(t->width*8-1))
+               if(isconst(nl, CTINT) && mpgetfix(nl->val.u.xval) != -(1ULL<<(t->width*8-1)))
                        check = 0;
                else if(isconst(nr, CTINT) && mpgetfix(nr->val.u.xval) != -1)
                        check = 0;
index f6031a5be7ebe096e788070fe421399aa1780ea8..b0b9097591b7602c1b4b80bb47a465a61c1ec195 100644 (file)
@@ -186,7 +186,7 @@ evconst(Node *n)
                break;
 
        case OASHL:
-               v = l->vconst << r->vconst;
+               v = (uvlong)l->vconst << r->vconst;
                break;
 
        case OLO: