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

syscall: constant overflows int for mips compile #21596

Closed
yinheli opened this issue Aug 24, 2017 · 3 comments
Closed

syscall: constant overflows int for mips compile #21596

yinheli opened this issue Aug 24, 2017 · 3 comments

Comments

@yinheli
Copy link

@yinheli yinheli commented Aug 24, 2017

TUNSETIFF = 0x800454ca

32bit system, int max value: 0x7fffffff (2147483647)

@jessfraz jessfraz changed the title constant overflows int for mips compile syscall: constant overflows int for mips compile Aug 24, 2017
@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Aug 24, 2017

@yinheli what is the problem? Do you have any program that fails to compile due to this?

The constant itself is ok, because it is an untyped integer instead of int.

@yinheli
Copy link
Author

@yinheli yinheli commented Aug 25, 2017

@cherrymui I'm using github.com/songgao/water to create tun device on mips (openwrt), go build reports:

vendor/github.com/songgao/water/syscalls_linux.go:73: constant 2147767498 overflows int
vendor/github.com/songgao/water/syscalls_linux.go:88: constant 2147767500 overflows int
vendor/github.com/songgao/water/syscalls_linux.go:93: constant 2147767502 overflows int
vendor/github.com/songgao/water/syscalls_linux.go:103: constant 2147767499 overflows int

env:

go version : 1.8.3

build env
GOOS=linux GOARCH=mips

https://github.com/songgao/water/blob/6b639456fceabd469cc76f5f4cec653b0cb7ce14/syscalls_linux.go#L86

You mean i have to convert the constant value to uint ?
thanks, i'll try to and do some tests

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Aug 25, 2017

It should normally work to change the request parameter of ioctl to be uint. That's how the implementations in golang.org/x/sys/unix work.

Closing because I don't think there is anything to change in the main Go repo.

yinheli added a commit to yinheli/water that referenced this issue Aug 28, 2017
issue detail : golang/go#21596
const is untyped int
@golang golang locked and limited conversation to collaborators Aug 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.