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

cgo doesn't work with structures that have bit fields #163

Closed
edsrzf opened this issue Nov 14, 2009 · 4 comments
Closed

cgo doesn't work with structures that have bit fields #163

edsrzf opened this issue Nov 14, 2009 · 4 comments

Comments

@edsrzf
Copy link

edsrzf commented Nov 14, 2009

Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?
1. Download the attached source file.
2. Run the command "cgo bitfield.go"

What is the expected output? What do you see instead?
I expect no output because the command will be successful. I got:

struct size calculation error

What is your $GOOS?  $GOARCH?
$GOOS = linux
$GOARCH = amd64

Which revision are you sync'ed to?  (hg log -l 1)
changeset:   4034:91b34a55c1a4
tag:         tip
user:        Rob Pike <r@golang.org>
date:        Fri Nov 13 16:00:55 2009 -0800
summary:     fix typo

Please provide any additional information below.
Digging into the cgo code a little, it looks like the problem's in gcc.go
in Struct(). off == 20, but dt.ByteSize == 4, but because they're not equal
the error is printed. 4 is the correct size.

Attachments:

  1. bitfield.go (246 bytes)
@rsc
Copy link
Contributor

rsc commented Nov 14, 2009

Comment 1:

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Nov 15, 2009

Comment 2:

Owner changed to r...@golang.org.

@rsc
Copy link
Contributor

rsc commented Dec 2, 2009

Comment 3:

Labels changed: added cgo.

@rsc
Copy link
Contributor

rsc commented Dec 17, 2009

Comment 4:

This issue was closed by revision 7a5f4be.

Status changed to Fixed.

Merged into issue #-.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants