aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/pack
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2013-09-09 15:07:23 -0400
committerRuss Cox <rsc@golang.org>2013-09-09 15:07:23 -0400
commit7d734d9252febfd91cb0ff5fc54f11defc5f4daa (patch)
treeff3ade73bd586a219fc64d333da6623cc3c9526f /src/cmd/pack
parent6252b41981a5e5566b727de14cda5aece4bee98f (diff)
downloadgo-7d734d9252febfd91cb0ff5fc54f11defc5f4daa.tar.gz
go-7d734d9252febfd91cb0ff5fc54f11defc5f4daa.zip
build: remove various uses of C undefined behavior
If you thought gcc -ansi -pedantic was pedantic, just wait until you meet clang -fsanitize=undefined. I think this addresses all the reported "errors", but we'll need another run to be sure. all.bash still passes. Update #5764 Dave, can you please try again? R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/13334049
Diffstat (limited to 'src/cmd/pack')
-rw-r--r--src/cmd/pack/ar.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/cmd/pack/ar.c b/src/cmd/pack/ar.c
index aff5f37eb9..5b300dbb96 100644
--- a/src/cmd/pack/ar.c
+++ b/src/cmd/pack/ar.c
@@ -937,21 +937,12 @@ objsym(Sym *s, void *p)
int
hashstr(char *name)
{
- int h;
+ uint32 h;
char *cp;
h = 0;
for(cp = name; *cp; h += *cp++)
h *= 1119;
-
- // the code used to say
- // if(h < 0)
- // h = ~h;
- // but on gcc 4.3 with -O2 on some systems,
- // the if(h < 0) gets compiled away as not possible.
- // use a mask instead, leaving plenty of bits but
- // definitely not the sign bit.
-
return h & 0xfffffff;
}