1
0
mirror of https://github.com/golang/go synced 2024-11-23 06:20:07 -07:00
go/misc/cgo/testcshared
Bryan C. Mills 3c4c10ea8c misc/cgo: fix aliasing bugs in parallel tests that append to shared slices
These tests use a slice to represent the base C compiler command (with
flags). Appending to that slice can cause subtle aliasing bugs, such
as commands that silently corrupt the arguments of other concurrent
commands in parallel tests.

In this change, we explicitly reduce the capacity of the command slice
to force appends to it to always allocate unique new slices.

Fixes #49693

Change-Id: Ide466bf65f12cb6cead3dcba69f513cccb60a160
Reviewed-on: https://go-review.googlesource.com/c/go/+/383754
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-07 17:51:57 +00:00
..
testdata all: add support for c-archive and c-shared on linux/riscv64 2021-11-03 09:23:34 +00:00
cshared_test.go misc/cgo: fix aliasing bugs in parallel tests that append to shared slices 2022-02-07 17:51:57 +00:00
overlaydir_test.go misc: remove use of relative directories in overlayDir functions 2019-11-25 16:26:15 +00:00