From 5cf2b4c2d39e0490b235822f5ea7fa105280b9f2 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Mon, 12 Nov 2018 16:49:52 -0500 Subject: [PATCH] cmd/compile: fix race on initializing Sym symFunc flag SSA lowering can create PFUNC ONAME nodes when compiling method calls. Since we generally initialize the node's Sym to a func when we set its class to PFUNC, we did this here, too. Unfortunately, since SSA compilation is concurrent, this can cause a race if two function compilations try to initialize the same symbol. Luckily, we don't need to do this at all, since we're actually just wrapping an ONAME node around an existing Sym that's already marked as a function symbol. Fixes the linux-amd64-racecompile builder, which was broken by CL 147158. Updates #27539. Change-Id: I8ddfce6e66a08ce53998c5bfa6f5a423c1ffc1eb Reviewed-on: https://go-review.googlesource.com/c/149158 Run-TryBot: Austin Clements TryBot-Result: Gobot Gobot Reviewed-by: David Chase --- src/cmd/compile/internal/gc/ssa.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go index 883cf7936d..9da45258f5 100644 --- a/src/cmd/compile/internal/gc/ssa.go +++ b/src/cmd/compile/internal/gc/ssa.go @@ -3670,7 +3670,7 @@ func (s *state) call(n *Node, k callKind) *ssa.Value { n2 := newnamel(fn.Pos, fn.Sym) n2.Name.Curfn = s.curfn n2.SetClass(PFUNC) - n2.Sym.SetFunc(true) + // n2.Sym already existed, so it's already marked as a function. n2.Pos = fn.Pos n2.Type = types.Types[TUINT8] // dummy type for a static closure. Could use runtime.funcval if we had it. closure = s.expr(n2) -- 2.50.0