1
0
mirror of https://github.com/golang/go synced 2024-11-26 22:11:25 -07:00

build: more "undefined behavior" fixes

Fixes #5764.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13441051
This commit is contained in:
Russ Cox 2013-09-10 14:54:55 -04:00
parent 80a153dd51
commit 6034406eae
4 changed files with 5 additions and 3 deletions

View File

@ -540,7 +540,7 @@ ginscon(int as, vlong c, Node *n2)
nodconst(&n1, types[TINT64], c);
if(as != AMOVQ && (c < -1LL<<31 || c >= 1LL<<31)) {
if(as != AMOVQ && (c < -(1LL<<31) || c >= 1LL<<31)) {
// cannot have 64-bit immediokate in ADD, etc.
// instead, MOV into register first.
regalloc(&ntmp, types[TINT64], N);

View File

@ -346,7 +346,7 @@ zaddr(char *pn, Biobuf *f, Adr *a, Sym *h[])
a->offset = BGETLE4(f);
if(t & T_64) {
a->offset &= 0xFFFFFFFFULL;
a->offset |= (vlong)BGETLE4(f) << 32;
a->offset |= (uvlong)BGETLE4(f) << 32;
}
}
a->sym = S;

View File

@ -1237,6 +1237,8 @@ found:
break;
}
if(z >= nelem(o->op))
sysfatal("asmins bad table %P", p);
op = o->op[z];
if(op == 0x0f) {
*andptr++ = op;

View File

@ -83,7 +83,7 @@ Bgetle4(Biobuf *bp)
l = Bgetle2(bp);
h = Bgetle2(bp);
return l|(h<<16);
return l|((uint32)h<<16);
}
int