From df459d5e6cc14532961875058f5d4ba3d04b5ed4 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Sat, 13 Oct 2018 15:48:17 -0700 Subject: [PATCH] cmd/compile: emit symbol for constant string before parallel compiler phase This CL makes sure we walk the newly generated assignment. Part of that walk makes sure that all symbols for strings are emitted before we start referencing them during the parallel compilation phase. Without this change, those references during the parallel phase do a create-if-not-exist, which leads to a data race. I'm not 100% sure this is the fix for the issues below, but optimistically assuming it is... Fixes #28170 Fixes #28159 Change-Id: Ic63d5160ad9be5cb23fa6bbb2183e4848776c0ff Reviewed-on: https://go-review.googlesource.com/c/141648 Run-TryBot: Keith Randall Reviewed-by: Josh Bleecher Snyder TryBot-Result: Gobot Gobot --- src/cmd/compile/internal/gc/walk.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go index 6b9ec51203..d33674f221 100644 --- a/src/cmd/compile/internal/gc/walk.go +++ b/src/cmd/compile/internal/gc/walk.go @@ -1460,7 +1460,9 @@ opswitch: as := nod(OAS, nod(OIND, p, nil), nod(OIND, convnop(nod(OSPTR, s, nil), t.PtrTo()), nil)) - init.Append(typecheck(as, Etop)) + as = typecheck(as, Etop) + as = walkstmt(as) + init.Append(as) } // Slice the [n]byte to a []byte. -- 2.48.1