You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
% hg id
36ffbae640bd+ tip
go tool cgo -godefs pack4.go on darwin outputs the following
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs pack4.go
package pack4
type Pack4k struct {
X uint32
Pad_cgo_0 [8]byte
Pad_cgo_1 [8]byte
}
instead of
type Pack4k struct {
X uint32
Pad_cgo_0 int64
Pad_cgo_1 int64
}
fwiw, go1.1 generates the latter.
The goal is to make a Go struct that corresponds to the C struct. In Go, int64 is
always aligned to an 8-byte boundary. In C it sometimes is not. In particular, it is
not on a 32-bit x86. Therefore the first Go struct (the one with the [8]byte fields) is
the only correct translation of the C struct in some cases. The second Go struct (with
the int64 fields) looks right but will do the wrong thing.
For the record, we agreed that for now we leave all stuff that generated previous godefs
as it is. We will fix the stuff when we see serious issues caused by wrong ABI layout.
See revision 7244ce3ae9db.
Attachments:
The text was updated successfully, but these errors were encountered: