Commit 6034406e authored by Russ Cox's avatar Russ Cox

build: more "undefined behavior" fixes

Fixes #5764.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13441051
parent 80a153dd
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -83,7 +83,7 @@ Bgetle4(Biobuf *bp)
l = Bgetle2(bp);
h = Bgetle2(bp);
return l|(h<<16);
return l|((uint32)h<<16);
}
int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment