1
0
mirror of https://github.com/golang/go synced 2024-10-05 16:41:21 -06:00
go/src/cmd
Ian Lance Taylor 7904946eeb cmd/cgo: discard trailing zero-sized fields in a non-empty C struct
In order to fix issue #9401 the compiler was changed to add a padding
byte to any non-empty Go struct that ends in a zero-sized field.  That
causes the Go version of such a C struct to have a different size than
the C struct, which can considerable confusion.  Change cgo so that it
discards any such zero-sized fields, so that the Go and C structs are
the same size.

This is a change from previous releases, in that it used to be
possible to refer to a zero-sized trailing field (by taking its
address), and with this change it no longer is.  That is unfortunate,
but something has to change.  It seems better to visibly break
programs that do this rather than to silently break programs that rely
on the struct sizes being the same.

Update #9401.
Fixes #11925.

Change-Id: I3fba3f02f11265b3c41d68616f79dedb05b81225
Reviewed-on: https://go-review.googlesource.com/12864
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-30 15:55:25 +00:00
..
addr2line cmd/addr2line: simplify windows test 2015-06-17 14:23:20 +00:00
api api: add go1.5.txt API file, reset next.txt 2015-07-21 02:48:35 +00:00
asm cmd/asm: fix and test CALL, JMP aliases on arm, arm64, ppc64 2015-07-28 14:19:53 +00:00
cgo cmd/cgo: discard trailing zero-sized fields in a non-empty C struct 2015-07-30 15:55:25 +00:00
compile cmd/compile: fix uninitialized memory during type switch assertE2I2 2015-07-30 05:21:56 +00:00
cover all: extract "can I exec?" check from tests into internal/testenv 2015-06-16 18:07:36 +00:00
dist cmd: delete old[5689]a 2015-07-29 03:45:26 +00:00
doc cmd/doc: extend darwin/arm64 test TODO to arm 2015-07-28 17:39:19 +00:00
fix cmd/fix: add gotypes module 2015-07-17 01:47:14 +00:00
go cmd: delete old[5689]a 2015-07-29 03:45:26 +00:00
gofmt cmd/gofmt, go/format: refactor common pieces into internal/format 2015-04-01 17:35:26 +00:00
internal cmd/internal/obj/arm: fix line numbers after constant pool 2015-07-30 15:47:31 +00:00
link cmd/link: fix nosplit stack overflow checks 2015-07-29 21:36:16 +00:00
newlink cmd/link: elide individual gcbits symbols 2015-07-22 20:27:24 +00:00
nm all: extract "can I exec?" check from tests into internal/testenv 2015-06-16 18:07:36 +00:00
objdump all: extract "can I exec?" check from tests into internal/testenv 2015-06-16 18:07:36 +00:00
pack all: extract "can I exec?" check from tests into internal/testenv 2015-06-16 18:07:36 +00:00
pprof cmd/pprof: fix race between viewer and web command 2015-07-23 03:51:39 +00:00
trace runtime/trace: add new package 2015-07-22 15:47:16 +00:00
vet all: link to https instead of http 2015-07-11 14:36:33 +00:00
yacc all: fix misprints in comments 2015-06-11 14:18:57 +00:00