go/misc
Ian Lance Taylor 6fa0ace128 [release-branch.go1.11] cmd/cgo: use field alignment when setting field offset
The old code ignored the field alignment, and only looked at the field
offset: if the field offset required padding, cgo added padding. But
while that approach works for Go (at least with the gc toolchain) it
doesn't work for C code using packed structs. With a packed struct the
added padding may leave the struct at a misaligned position, and the
inserted alignment, which cgo is not considering, may introduce
additional, unexpected, padding. Padding that ignores alignment is not
a good idea when the struct is not packed, and Go structs are never
packed. So don't ignore alignment.

Updates #28896
Fixes #28916

Change-Id: Ie50ea15fa6dc35557497097be9fecfecb11efd8a
Reviewed-on: https://go-review.googlesource.com/c/150602
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
(cherry picked from commit fbdaa96563)
Reviewed-on: https://go-review.googlesource.com/c/151778
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-03 04:59:56 +00:00
..
android misc/android: forward SIGQUIT to the process running on the device 2018-05-23 18:18:39 +00:00
arm
cgo [release-branch.go1.11] cmd/cgo: use field alignment when setting field offset 2018-12-03 04:59:56 +00:00
chrome/gophertool
git
ios misc/ios: forward SIGQUIT to the iOS program 2018-05-11 16:47:28 +00:00
linkcheck
nacl all: use HTTPS for iana.org links 2018-02-13 18:36:48 +00:00
sortac
swig cmd/go: fix swig support and run swig tests during run.bash 2017-11-16 17:19:19 +00:00
trace misc/trace: update trace_viewer_full.html 2018-04-26 20:26:23 +00:00
wasm [release-branch.go1.11] misc/wasm: add mention of polyfill for Edge support 2018-10-02 17:33:25 +00:00
benchcmp
editors