cmd/cgo: miscalculates C array offset when C struct has __attribute__((__packed__)) #46675
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputC compiler:
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
on Ubuntu 18.04What did you do?
I execute
go run x.go
with the following input file:What did you expect to see?
What did you see instead?
Notice that cgo and gcc reports different size for C structs.
Additional Information
If
struct P
is changed to:It also causes cgo to misbehave:
The text was updated successfully, but these errors were encountered: