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

cmd/cgo: mishandles 40 bit bitfield #22958

Closed
ianlancetaylor opened this issue Dec 1, 2017 · 2 comments

Comments

@ianlancetaylor
Copy link
Contributor

commented Dec 1, 2017

Building this test case with go build foo.go

package p

/*
typedef struct {
	unsigned long x : 40;
} s;
*/
import "C"

var v C.s

produces

# command-line-arguments
/tmp/go-build300185653/b001/_cgo_gotypes.go:23:4: undefined: uint40

Oddly, something seems to be special about the number 40.

@ianlancetaylor ianlancetaylor added this to the Go1.11 milestone Dec 1, 2017

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor Author

commented Dec 1, 2017

Ah, it fails when the bit size is a multiple of 8 other than 8, 16, 32, 64.

@gopherbot

This comment has been minimized.

Copy link

commented Dec 1, 2017

Change https://golang.org/cl/81435 mentions this issue: cmd/cgo: for C bitfields use only valid Go integer types

@gopherbot gopherbot closed this in bfa7a55 Dec 1, 2017

@golang golang locked and limited conversation to collaborators Dec 1, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.