cmd/6c, cmd/6g, cmd/cc: fix undefined behavior warnings

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
This commit is contained in:
Dave Cheney 2013-09-17 13:43:27 +10:00
parent 16d6b6c771
commit 8d5ec52e6c
3 changed files with 3 additions and 3 deletions

View 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");

View 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;

View 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: