diff options
author | Devon H. O'Dell <devon.odell@gmail.com> | 2009-12-17 12:38:29 -0800 |
---|---|---|
committer | Devon H. O'Dell <devon.odell@gmail.com> | 2009-12-17 12:38:29 -0800 |
commit | 76dd1e72a72bd8a9541c2af785e36d2f5b5ea57e (patch) | |
tree | 0cef9a567dc6166498a21210d2bce80eb24cedd5 /src/cmd/cgo/gcc.go | |
parent | fcc1ded24e2ffc357003b66abdd9b5a86589e6c6 (diff) | |
download | golang-76dd1e72a72bd8a9541c2af785e36d2f5b5ea57e.tar.gz |
Use BitSize instead of the field's type native ByteSize when calculating
structs containing bitfields.
Fixes issue 163.
R=rsc
CC=golang-dev
http://codereview.appspot.com/180059
Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/cmd/cgo/gcc.go')
-rw-r--r-- | src/cmd/cgo/gcc.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go index 07bfa8ab6..aeca50eec 100644 --- a/src/cmd/cgo/gcc.go +++ b/src/cmd/cgo/gcc.go @@ -693,6 +693,9 @@ func (c *typeConv) Struct(dt *dwarf.StructType) (expr *ast.StructType, csyntax s } for _, f := range dt.Field { + if f.BitSize > 0 && f.BitSize != f.ByteSize*8 { + continue + } if f.ByteOffset > off { fld = c.pad(fld, f.ByteOffset-off) off = f.ByteOffset |