]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/ld: fix undefined behaviour in pcln.c
authorDave Cheney <dave@cheney.net>
Thu, 21 Aug 2014 23:10:33 +0000 (09:10 +1000)
committerDave Cheney <dave@cheney.net>
Thu, 21 Aug 2014 23:10:33 +0000 (09:10 +1000)
Update #8527

Fixes, src/cmd/6l/../ld/pcln.c:93:18: runtime error: left shift of negative value -2

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/127440043

src/cmd/ld/pcln.c

index 4c2ffa78e1d3c619d6aac549ac0939a2fc0d5eba..17f4f992fcd0ad67b166e680c270e38219eab3e7 100644 (file)
@@ -90,7 +90,7 @@ renumberfiles(Link *ctxt, LSym **files, int nfiles, Pcdata *d)
                }
                dv = val - newval;
                newval = val;
-               v = (uint32)(dv<<1) ^ (uint32)(int32)(dv>>31);
+               v = ((uint32)dv<<1) ^ (uint32)(int32)(dv>>31);
                addvarint(&out, v);
 
                // pc delta