1
0
mirror of https://github.com/golang/go synced 2024-11-22 01:44:40 -07:00

cc, ld: fix more gcc 4.3 -O2 compile bugs

same as https://golang.org/cl/152088
in more files.

Fixes #83.

R=r, r1
https://golang.org/cl/152091
This commit is contained in:
Russ Cox 2009-11-12 00:22:45 -08:00
parent 6dbd142951
commit 6634e3432d
3 changed files with 5 additions and 6 deletions

View File

@ -411,8 +411,7 @@ lookup(void)
h += *p++;
}
n = (p - symb) + 1;
if((int32)h < 0)
h = ~h;
h &= 0xffffff;
h %= NHASH;
c = symb[0];
for(s = hash[h]; s != S; s = s->link) {

View File

@ -42,8 +42,8 @@ hashstr(char *name)
h = 0;
for(cp = name; *cp; h += *cp++)
h *= 1119;
if(h < 0)
h = ~h;
// not if(h < 0) h = ~h, because gcc 4.3 -O2 miscompiles it.
h &= 0xffffff;
return h;
}

View File

@ -384,8 +384,8 @@ lookup(char *symb, int v)
for(p=symb; c = *p; p++)
h = h+h+h + c;
l = (p - symb) + 1;
if(h < 0)
h = ~h;
// not if(h < 0) h = ~h, because gcc 4.3 -O2 miscompiles it.
h &= 0xffffff;
h %= NHASH;
for(s = hash[h]; s != S; s = s->link)
if(s->version == v)