1
0
mirror of https://github.com/golang/go synced 2024-11-08 19:16:25 -07:00
go/misc/cgo/test
Austin Clements f423d616b1 cmd/cgo: fix initialization of empty argument types
CL 258938 changed the way C to Go calls work such that they now
construct a C struct on the C side for the arguments and space for the
results. Any pointers in the result space must be zeroed, so we just
zero the whole struct.

However, C makes it surprisingly hard to robustly zero any struct
type. We had used a "{0}" initializer, which works in the vast
majority of cases, but fails if the type is empty or effectively
empty.

This CL fixes this by changing how the cgo tool zero-initializes the
argument struct to be more robust.

Fixes #42495.

Change-Id: Id1749b9d751e59eb7a02a9d44fec0698a2bf63cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/269337
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-11-13 15:15:15 +00:00
..
testdata cmd/dist,cmd/go,runtime: add support for cgo on linux/riscv64 2020-11-03 12:59:51 +00:00
backdoor.go
buildid_linux.go
callback_c_gc.c
callback_c_gccgo.c
callback_c.c
callback.go runtime,cmd/cgo: simplify C -> Go call path 2020-10-26 14:50:32 +00:00
cgo_linux_test.go syscall: support POSIX semantics for Linux syscalls 2020-10-23 20:53:14 +00:00
cgo_stubs_android_test.go
cgo_test.go misc/cgo/test: test C.enum_* 2020-10-27 18:13:59 +00:00
cgo_thread_lock.go
cgo_unix_test.go
cthread_unix.c
cthread_windows.c
issue1435.go syscall: improve TestSetuidEtc() /proc/ parsing against races 2020-11-11 20:49:53 +00:00
issue4029.c cmd/link: support cgo internal/linking on darwin/arm64 2020-10-20 02:25:52 +00:00
issue4029.go cmd/link: support cgo internal/linking on darwin/arm64 2020-10-20 02:25:52 +00:00
issue4029w.go cmd/link: support cgo internal/linking on darwin/arm64 2020-10-20 02:25:52 +00:00
issue4273.c
issue4273b.c
issue4339.c
issue4339.h
issue5548_c.c
issue5740a.c
issue5740b.c
issue6833_c.c
issue6907export_c.c
issue6997_linux.c
issue6997_linux.go
issue7234_test.go
issue8148.go
issue8331.h
issue8517_windows.c
issue8517_windows.go
issue8517.go
issue8694.go
issue8811.c
issue18146.go all: add GOOS=ios 2020-09-23 18:12:59 +00:00
issue20910.c
issue21897.go
issue21897b.go
issue31891.c
issue42495.go cmd/cgo: fix initialization of empty argument types 2020-11-13 15:15:15 +00:00
overlaydir_test.go
pkg_test.go all: add GOOS=ios 2020-09-23 18:12:59 +00:00
setgid_linux.go
sigaltstack.go runtime: use sigaltstack on macOS/ARM64 2020-10-06 21:25:42 +00:00
sigprocmask.c
sigprocmask.go
test_unix.go
test_windows.go
test.go misc/cgo/test: test C.enum_* 2020-10-27 18:13:59 +00:00
testx.go all: add GOOS=ios 2020-09-23 18:12:59 +00:00