]> Cypherpunks repositories - gostls13.git/commitdiff
two more if(h<0) that gcc 4.3 -O2 miscompiles
authorRuss Cox <rsc@golang.org>
Mon, 23 Nov 2009 22:23:14 +0000 (14:23 -0800)
committerRuss Cox <rsc@golang.org>
Mon, 23 Nov 2009 22:23:14 +0000 (14:23 -0800)
R=r
https://golang.org/cl/160044

src/cmd/cc/lexbody
src/libmach/obj.c

index f5a250fcf7da4e157929a7217eeaace4c209cbff..ba5eda8242f470e3c800dadb435f9b3f34892ce4 100644 (file)
@@ -226,8 +226,7 @@ lookup(void)
        for(p=symb; c = *p; p++)
                h = h+h+h + c;
        l = (p - symb) + 1;
-       if(h < 0)
-               h = ~h;
+       h &= 0xffffff;
        h %= NHASH;
        c = symb[0];
        for(s = hash[h]; s != S; s = s->link) {
index aa914e2c761725a9582f931b022c58e31186b3e7..dacb2ae1fa76a76ffe57997d0f7909e9993af01f 100644 (file)
@@ -257,9 +257,7 @@ objlookup(int id, char *name, int type, uint sig)
        h = *name;
        for(cp = name+1; *cp; h += *cp++)
                h *= HASHMUL;
-       if(h < 0)
-               h = ~h;
-       h &= (NHASH-1);
+       h &= NHASH-1;
        if (type == 'U' || type == 'b' || islocal(type)) {
                for(sp = hash[h]; sp; sp = sp->next)
                        if(strcmp(sp->s.name, name) == 0) {