]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.18] cmd/compile: copy blank parameter node when substituting...
authorCherry Mui <cherryyz@google.com>
Fri, 14 Oct 2022 23:52:00 +0000 (19:52 -0400)
committerMichael Knyszek <mknyszek@google.com>
Tue, 8 Nov 2022 18:44:13 +0000 (18:44 +0000)
commitd9c62ce86a3fd42704f3804d3e31157c57b1f7b3
tree2af079803533aa2902f7f0f0788fc73f6d5a450e
parente54e808d781745e12b0f7ce471934735750e7015
[release-branch.go1.18] cmd/compile: copy blank parameter node when substituting function type

When a function type is copied (e.g. for substituting type
parameters), we make copies of its parameter ir.Name nodes, so
they are not shared with the old function type. But currently a
blank (_) identifier is not copied but shared. The parameter
node's frame offset is assigned (in ABI analysis) and then used in
the concurrent backend. Shared node can cause a data race. Make a
new blank parameter node to avoid sharing. (Unified IR does already
not have this problem. This fixes non-unified-IR mode.)

Updates #55357.
Fixes #56359.

Change-Id: Ie27f08e5589ac7d5d3f0d0d5de1a21e4fd2765c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/443158
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
(cherry picked from commit 4725c71b735143a138b24f2b0e055c717d8d69ca)
Reviewed-on: https://go-review.googlesource.com/c/go/+/445177
src/cmd/compile/internal/test/race.go [new file with mode: 0644]
src/cmd/compile/internal/typecheck/subr.go