Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

int overflow on 32 bits arches #169

Closed
eclipseo opened this issue Jul 1, 2019 · 9 comments · Fixed by #191
Closed

int overflow on 32 bits arches #169

eclipseo opened this issue Jul 1, 2019 · 9 comments · Fixed by #191

Comments

@eclipseo
Copy link

eclipseo commented Jul 1, 2019

Golang 1.12.6 on i686 and armv7:

Testing    in: /builddir/build/BUILD/goavro-2.8.4/_build/src
         PATH: /builddir/build/BUILD/goavro-2.8.4/_build/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin
       GOPATH: /builddir/build/BUILD/goavro-2.8.4/_build:/usr/share/gocode
  GO111MODULE: off
      command: go test -buildmode pie -compiler gc -ldflags "-X github.com/linkedin/goavro/version=2.8.4 -extldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '"
      testing: github.com/linkedin/goavro
github.com/linkedin/goavro
FAIL	github.com/linkedin/goavro [build failed]
BUILDSTDERR: # github.com/linkedin/goavro [github.com/linkedin/goavro.test]
BUILDSTDERR: ./binary_test.go:42:50: constant -9223372036854775808 overflows int
BUILDSTDERR: ./integer_test.go:56:42: constant 9223372036854775807 overflows int
BUILDSTDERR: ./integer_test.go:57:35: constant -9223372036854775808 overflows int
BUILDSTDERR: ./integer_test.go:63:35: constant 1359702038045356208 overflows int
BUILDSTDERR: ./integer_test.go:64:35: constant 138521149956 overflows int
BUILDSTDERR: ./integer_test.go:65:35: constant 17730707194372 overflows int
BUILDSTDERR: ./integer_test.go:67:35: constant 2269530520879620 overflows int
BUILDSTDERR: ./integer_test.go:69:35: constant 5959107741628848600 overflows int
BUILDSTDERR: ./integer_test.go:73:35: constant -5513458701470791632 overflows int
@karrick
Copy link
Contributor

karrick commented Jul 2, 2019

I think 32-bit support was an issue a few years ago but it looks like something snuck back in because we don’t have a routine test suite running on 32-but architectures. I’ll take a look after the holidays. I’m pretty sure the tests merely need to be changed to use math.MaxInt and friends to make them work again.

@karrick
Copy link
Contributor

karrick commented Jul 10, 2019

Puzzling. The very first error from the failed tests you pasted above is from a line that does actually use math.MinInt64 for that constant value, which, presumably on 32-bit architectures should be the correct value, but rather than showing up in the output as -2147483648, the 64-bit version is there instead.

mostNegativeBlockCount, err = c.BinaryFromNative(nil, math.MinInt64)

@karrick
Copy link
Contributor

karrick commented Jul 10, 2019

env GOARCH=386 go test
# github.com/linkedin/goavro/v2 [github.com/linkedin/goavro/v2.test]
./binary_test.go:42:50: constant -9223372036854775808 overflows int
./integer_test.go:56:42: constant 9223372036854775807 overflows int
./integer_test.go:57:35: constant -9223372036854775808 overflows int
./integer_test.go:63:35: constant 1359702038045356208 overflows int
./integer_test.go:64:35: constant 138521149956 overflows int
./integer_test.go:65:35: constant 17730707194372 overflows int
./integer_test.go:67:35: constant 2269530520879620 overflows int
./integer_test.go:69:35: constant 5959107741628848600 overflows int
./integer_test.go:73:35: constant -5513458701470791632 overflows int
FAIL    github.com/linkedin/goavro/v2 [build failed]

@karrick
Copy link
Contributor

karrick commented Jul 12, 2019

Relates to #103

@cobolbaby
Copy link

Because the program needs to run on win2003, is there any plan to fix this bug?

@karrick
Copy link
Contributor

karrick commented Jul 17, 2019

I had thought that 32 bit support worked.

I went ahead and tried on my 64 bit machine using GOATCH=386 but still get the errors.

I wish I had the ability to fix this bug but I don’t have any 32 bit machines to iterate on.

@cobolbaby
Copy link

You can run Win XP in a virtual machine.

@rogpeppe
Copy link

It's easy to demonstrate this issue on the Go playground.

@cobolbaby
Copy link

Any Progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants