bit shifing errors in core/util/packed/bulkOperation*
dgryski opened this issue · 5 comments
The current 'go vet' includes checks for shifts larger than the width of the variable being shifted, and it picks up a large number of issues in the above files.
I'm not sure if they're all errors, but they're probably worth looking at
core/util/packed/bulkOperation10.go:76: (byte3 & 3) too small for shift of 8
core/util/packed/bulkOperation10.go:142: (byte3 & 3) too small for shift of 8
core/util/packed/bulkOperation11.go:112: (byte2 & 3) too small for shift of 9
core/util/packed/bulkOperation11.go:126: (byte6 & 1) too small for shift of 10
core/util/packed/bulkOperation11.go:134: (byte9 & 7) too small for shift of 8
core/util/packed/bulkOperation11.go:236: (byte2 & 3) too small for shift of 9
core/util/packed/bulkOperation11.go:250: (byte6 & 1) too small for shift of 10
core/util/packed/bulkOperation11.go:258: (byte9 & 7) too small for shift of 8
core/util/packed/bulkOperation12.go:50: (byte1 & 15) too small for shift of 8
core/util/packed/bulkOperation12.go:90: (byte1 & 15) too small for shift of 8
core/util/packed/bulkOperation13.go:110: (byte1 & 7) too small for shift of 10
core/util/packed/bulkOperation13.go:120: (byte4 & 1) too small for shift of 12
core/util/packed/bulkOperation13.go:126: (byte6 & 15) too small for shift of 9
core/util/packed/bulkOperation13.go:136: (byte9 & 3) too small for shift of 11
core/util/packed/bulkOperation13.go:140: (byte11 & 31) too small for shift of 8
core/util/packed/bulkOperation13.go:240: (byte1 & 7) too small for shift of 10
core/util/packed/bulkOperation13.go:250: (byte4 & 1) too small for shift of 12
core/util/packed/bulkOperation13.go:256: (byte6 & 15) too small for shift of 9
core/util/packed/bulkOperation13.go:266: (byte9 & 3) too small for shift of 11
core/util/packed/bulkOperation13.go:270: (byte11 & 31) too small for shift of 8
core/util/packed/bulkOperation14.go:72: (byte1 & 3) too small for shift of 12
core/util/packed/bulkOperation14.go:78: (byte3 & 15) too small for shift of 10
core/util/packed/bulkOperation14.go:82: (byte5 & 63) too small for shift of 8
core/util/packed/bulkOperation14.go:144: (byte1 & 3) too small for shift of 12
core/util/packed/bulkOperation14.go:150: (byte3 & 15) too small for shift of 10
core/util/packed/bulkOperation14.go:154: (byte5 & 63) too small for shift of 8
core/util/packed/bulkOperation15.go:112: (byte1 & 1) too small for shift of 14
core/util/packed/bulkOperation15.go:118: (byte3 & 3) too small for shift of 13
core/util/packed/bulkOperation15.go:124: (byte5 & 7) too small for shift of 12
core/util/packed/bulkOperation15.go:130: (byte7 & 15) too small for shift of 11
core/util/packed/bulkOperation15.go:136: (byte9 & 31) too small for shift of 10
core/util/packed/bulkOperation15.go:142: (byte11 & 63) too small for shift of 9
core/util/packed/bulkOperation15.go:146: (byte13 & 127) too small for shift of 8
core/util/packed/bulkOperation15.go:248: (byte1 & 1) too small for shift of 14
core/util/packed/bulkOperation15.go:254: (byte3 & 3) too small for shift of 13
core/util/packed/bulkOperation15.go:260: (byte5 & 7) too small for shift of 12
core/util/packed/bulkOperation15.go:266: (byte7 & 15) too small for shift of 11
core/util/packed/bulkOperation15.go:272: (byte9 & 31) too small for shift of 10
core/util/packed/bulkOperation15.go:278: (byte11 & 63) too small for shift of 9
core/util/packed/bulkOperation15.go:282: (byte13 & 127) too small for shift of 8
core/util/packed/bulkOperation17.go:110: byte0 too small for shift of 9
core/util/packed/bulkOperation17.go:116: (byte2 & 127) too small for shift of 10
core/util/packed/bulkOperation17.go:122: (byte4 & 63) too small for shift of 11
core/util/packed/bulkOperation17.go:128: (byte6 & 31) too small for shift of 12
core/util/packed/bulkOperation17.go:134: (byte8 & 15) too small for shift of 13
core/util/packed/bulkOperation17.go:140: (byte10 & 7) too small for shift of 14
core/util/packed/bulkOperation17.go:146: (byte12 & 3) too small for shift of 15
core/util/packed/bulkOperation17.go:152: (byte14 & 1) too small for shift of 16
core/util/packed/bulkOperation17.go:152: byte15 too small for shift of 8
core/util/packed/bulkOperation17.go:252: byte0 too small for shift of 9
core/util/packed/bulkOperation17.go:258: (byte2 & 127) too small for shift of 10
core/util/packed/bulkOperation17.go:264: (byte4 & 63) too small for shift of 11
core/util/packed/bulkOperation17.go:270: (byte6 & 31) too small for shift of 12
core/util/packed/bulkOperation17.go:276: (byte8 & 15) too small for shift of 13
core/util/packed/bulkOperation17.go:282: (byte10 & 7) too small for shift of 14
core/util/packed/bulkOperation17.go:288: (byte12 & 3) too small for shift of 15
core/util/packed/bulkOperation17.go:294: (byte14 & 1) too small for shift of 16
core/util/packed/bulkOperation17.go:294: byte15 too small for shift of 8
core/util/packed/bulkOperation18.go:70: byte0 too small for shift of 10
core/util/packed/bulkOperation18.go:76: (byte2 & 63) too small for shift of 12
core/util/packed/bulkOperation18.go:82: (byte4 & 15) too small for shift of 14
core/util/packed/bulkOperation18.go:88: (byte6 & 3) too small for shift of 16
core/util/packed/bulkOperation18.go:88: byte7 too small for shift of 8
core/util/packed/bulkOperation18.go:148: byte0 too small for shift of 10
core/util/packed/bulkOperation18.go:154: (byte2 & 63) too small for shift of 12
core/util/packed/bulkOperation18.go:160: (byte4 & 15) too small for shift of 14
core/util/packed/bulkOperation18.go:166: (byte6 & 3) too small for shift of 16
core/util/packed/bulkOperation18.go:166: byte7 too small for shift of 8
core/util/packed/bulkOperation19.go:112: byte0 too small for shift of 11
core/util/packed/bulkOperation19.go:118: (byte2 & 31) too small for shift of 14
core/util/packed/bulkOperation19.go:126: (byte4 & 3) too small for shift of 17
core/util/packed/bulkOperation19.go:126: byte5 too small for shift of 9
core/util/packed/bulkOperation19.go:132: (byte7 & 127) too small for shift of 12
core/util/packed/bulkOperation19.go:138: (byte9 & 15) too small for shift of 15
core/util/packed/bulkOperation19.go:146: (byte11 & 1) too small for shift of 18
core/util/packed/bulkOperation19.go:146: byte12 too small for shift of 10
core/util/packed/bulkOperation19.go:152: (byte14 & 63) too small for shift of 13
core/util/packed/bulkOperation19.go:158: (byte16 & 7) too small for shift of 16
core/util/packed/bulkOperation19.go:158: byte17 too small for shift of 8
core/util/packed/bulkOperation19.go:260: byte0 too small for shift of 11
core/util/packed/bulkOperation19.go:266: (byte2 & 31) too small for shift of 14
core/util/packed/bulkOperation19.go:274: (byte4 & 3) too small for shift of 17
core/util/packed/bulkOperation19.go:274: byte5 too small for shift of 9
core/util/packed/bulkOperation19.go:280: (byte7 & 127) too small for shift of 12
core/util/packed/bulkOperation19.go:286: (byte9 & 15) too small for shift of 15
core/util/packed/bulkOperation19.go:294: (byte11 & 1) too small for shift of 18
core/util/packed/bulkOperation19.go:294: byte12 too small for shift of 10
core/util/packed/bulkOperation19.go:300: (byte14 & 63) too small for shift of 13
core/util/packed/bulkOperation19.go:306: (byte16 & 7) too small for shift of 16
core/util/packed/bulkOperation19.go:306: byte17 too small for shift of 8
core/util/packed/bulkOperation20.go:50: byte0 too small for shift of 12
core/util/packed/bulkOperation20.go:56: (byte2 & 15) too small for shift of 16
core/util/packed/bulkOperation20.go:56: byte3 too small for shift of 8
core/util/packed/bulkOperation20.go:96: byte0 too small for shift of 12
core/util/packed/bulkOperation20.go:102: (byte2 & 15) too small for shift of 16
core/util/packed/bulkOperation20.go:102: byte3 too small for shift of 8
core/util/packed/bulkOperation21.go:114: byte0 too small for shift of 13
core/util/packed/bulkOperation21.go:122: (byte2 & 7) too small for shift of 18
core/util/packed/bulkOperation21.go:122: byte3 too small for shift of 10
core/util/packed/bulkOperation21.go:128: (byte5 & 63) too small for shift of 15
core/util/packed/bulkOperation21.go:136: (byte7 & 1) too small for shift of 20
core/util/packed/bulkOperation21.go:136: byte8 too small for shift of 12
core/util/packed/bulkOperation21.go:144: (byte10 & 15) too small for shift of 17
core/util/packed/bulkOperation21.go:144: byte11 too small for shift of 9
core/util/packed/bulkOperation21.go:150: (byte13 & 127) too small for shift of 14
core/util/packed/bulkOperation21.go:158: (byte15 & 3) too small for shift of 19
core/util/packed/bulkOperation21.go:158: byte16 too small for shift of 11
core/util/packed/bulkOperation21.go:164: (byte18 & 31) too small for shift of 16
core/util/packed/bulkOperation21.go:164: byte19 too small for shift of 8
core/util/packed/bulkOperation21.go:268: byte0 too small for shift of 13
core/util/packed/bulkOperation21.go:276: (byte2 & 7) too small for shift of 18
core/util/packed/bulkOperation21.go:276: byte3 too small for shift of 10
core/util/packed/bulkOperation21.go:282: (byte5 & 63) too small for shift of 15
core/util/packed/bulkOperation21.go:290: (byte7 & 1) too small for shift of 20
core/util/packed/bulkOperation21.go:290: byte8 too small for shift of 12
core/util/packed/bulkOperation21.go:298: (byte10 & 15) too small for shift of 17
core/util/packed/bulkOperation21.go:298: byte11 too small for shift of 9
core/util/packed/bulkOperation21.go:304: (byte13 & 127) too small for shift of 14
core/util/packed/bulkOperation21.go:312: (byte15 & 3) too small for shift of 19
core/util/packed/bulkOperation21.go:312: byte16 too small for shift of 11
core/util/packed/bulkOperation21.go:318: (byte18 & 31) too small for shift of 16
core/util/packed/bulkOperation21.go:318: byte19 too small for shift of 8
core/util/packed/bulkOperation22.go:72: byte0 too small for shift of 14
core/util/packed/bulkOperation22.go:80: (byte2 & 3) too small for shift of 20
core/util/packed/bulkOperation22.go:80: byte3 too small for shift of 12
core/util/packed/bulkOperation22.go:88: (byte5 & 15) too small for shift of 18
core/util/packed/bulkOperation22.go:88: byte6 too small for shift of 10
core/util/packed/bulkOperation22.go:94: (byte8 & 63) too small for shift of 16
core/util/packed/bulkOperation22.go:94: byte9 too small for shift of 8
core/util/packed/bulkOperation22.go:156: byte0 too small for shift of 14
core/util/packed/bulkOperation22.go:164: (byte2 & 3) too small for shift of 20
core/util/packed/bulkOperation22.go:164: byte3 too small for shift of 12
core/util/packed/bulkOperation22.go:172: (byte5 & 15) too small for shift of 18
core/util/packed/bulkOperation22.go:172: byte6 too small for shift of 10
core/util/packed/bulkOperation22.go:178: (byte8 & 63) too small for shift of 16
core/util/packed/bulkOperation22.go:178: byte9 too small for shift of 8
core/util/packed/bulkOperation23.go:116: byte0 too small for shift of 15
core/util/packed/bulkOperation23.go:124: (byte2 & 1) too small for shift of 22
core/util/packed/bulkOperation23.go:124: byte3 too small for shift of 14
core/util/packed/bulkOperation23.go:132: (byte5 & 3) too small for shift of 21
core/util/packed/bulkOperation23.go:132: byte6 too small for shift of 13
core/util/packed/bulkOperation23.go:140: (byte8 & 7) too small for shift of 20
core/util/packed/bulkOperation23.go:140: byte9 too small for shift of 12
core/util/packed/bulkOperation23.go:148: (byte11 & 15) too small for shift of 19
core/util/packed/bulkOperation23.go:148: byte12 too small for shift of 11
core/util/packed/bulkOperation23.go:156: (byte14 & 31) too small for shift of 18
core/util/packed/bulkOperation23.go:156: byte15 too small for shift of 10
core/util/packed/bulkOperation23.go:164: (byte17 & 63) too small for shift of 17
core/util/packed/bulkOperation23.go:164: byte18 too small for shift of 9
core/util/packed/bulkOperation23.go:170: (byte20 & 127) too small for shift of 16
core/util/packed/bulkOperation23.go:170: byte21 too small for shift of 8
core/util/packed/bulkOperation23.go:276: byte0 too small for shift of 15
core/util/packed/bulkOperation23.go:284: (byte2 & 1) too small for shift of 22
core/util/packed/bulkOperation23.go:284: byte3 too small for shift of 14
core/util/packed/bulkOperation23.go:292: (byte5 & 3) too small for shift of 21
core/util/packed/bulkOperation23.go:292: byte6 too small for shift of 13
core/util/packed/bulkOperation23.go:300: (byte8 & 7) too small for shift of 20
core/util/packed/bulkOperation23.go:300: byte9 too small for shift of 12
core/util/packed/bulkOperation23.go:308: (byte11 & 15) too small for shift of 19
core/util/packed/bulkOperation23.go:308: byte12 too small for shift of 11
core/util/packed/bulkOperation23.go:316: (byte14 & 31) too small for shift of 18
core/util/packed/bulkOperation23.go:316: byte15 too small for shift of 10
core/util/packed/bulkOperation23.go:324: (byte17 & 63) too small for shift of 17
core/util/packed/bulkOperation23.go:324: byte18 too small for shift of 9
core/util/packed/bulkOperation23.go:330: (byte20 & 127) too small for shift of 16
core/util/packed/bulkOperation23.go:330: byte21 too small for shift of 8
core/util/packed/bulkOperation24.go:40: byte0 too small for shift of 16
core/util/packed/bulkOperation24.go:40: byte1 too small for shift of 8
core/util/packed/bulkOperation24.go:70: byte0 too small for shift of 16
core/util/packed/bulkOperation24.go:70: byte1 too small for shift of 8
core/util/packed/bulkOperation9.go:128: (byte7 & 1) too small for shift of 8
core/util/packed/bulkOperation9.go:246: (byte7 & 1) too small for shift of 8
Thanks for sharing. I have been suffering from byte overflow for quite some time. It causes mysterious errors and is very hard to debug.
@dgryski Which command are you using to generate the list?
This was generated with https://godoc.org/golang.org/x/tools/cmd/vet
I tried but it seems my 1.3.3 go vet doesn't contain that function. I will have another try later. Thanks.
You can upgrade your go vet with "go get -u golang.org/x/tools/cmd/vet"
With proxy and hg, I'm able to install the latest vet now. The error has been fixed. There are other warnings from vet, I will fix them in branch lucene410.