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: missing field in packed struct #8373

Closed
gopherbot opened this issue Jul 15, 2014 · 1 comment

Comments

@gopherbot
Copy link

commented Jul 15, 2014

by Jonathan.Plona:

What does 'go version' print?
go version go1.3 linux/amd64

What steps reproduce the problem?

1.  Create a C struct with two fields, a uint32_t and a uint64_t, and
__attribute__((packed)).
2.  Try to access the second field.

What happened?
The second field is not detected:

./bug.go:14: bug.b undefined (type C.struct_bug has no field or method b)

What should have happened instead?

The second field is detected and can be used.

Please provide any additional information below.

Go 1.2.2 builds the code without problem

Attachments:

  1. bug.go (190 bytes)
@minux

This comment has been minimized.

Copy link
Member

commented Jul 15, 2014

Comment 1:

the second field is mis-aligned according to Go's rule of field
alignment, so it's impossible for Go to access the 2nd field.
This is actually a bug of previous Go version.

Status changed to WorkingAsIntended.

@golang golang locked and limited conversation to collaborators Jun 25, 2016

This issue was closed.
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.