]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: avoid collisions between statictmps and user vars
authorAlessandro Arzilli <alessandro.arzilli@gmail.com>
Tue, 16 Oct 2018 14:11:59 +0000 (16:11 +0200)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 26 Feb 2019 22:59:15 +0000 (22:59 +0000)
Avoid name collisions between autogenerated statictmp variables and
user defined global variables.

Fixes #25113

Change-Id: I023eb42a5c2bd2f5352b046d33363faed87084dc
Reviewed-on: https://go-review.googlesource.com/c/142497
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/sinit.go
src/cmd/compile/internal/ssa/writebarrier.go

index de0298b746fe46709f17b028a7709367e9c8e51b..efdaf1c3c5c5a387394ec91deacf562bdef113ee 100644 (file)
@@ -568,7 +568,7 @@ var statuniqgen int // name generator for static temps
 // returned node for readonly nodes.
 func staticname(t *types.Type) *Node {
        // Don't use lookupN; it interns the resulting string, but these are all unique.
-       n := newname(lookup(fmt.Sprintf("statictmp_%d", statuniqgen)))
+       n := newname(lookup(fmt.Sprintf(".stmp_%d", statuniqgen)))
        statuniqgen++
        addvar(n, t, PEXTERN)
        return n
index 1024ab25abf8a8d480ed6c31aee5af1e0ca56a74..1f40927951909badb10897b5f692ccd0a514126a 100644 (file)
@@ -439,7 +439,7 @@ func IsSanitizerSafeAddr(v *Value) bool {
                // test sym.Type==objabi.SRODATA, but we don't
                // initialize sym.Type until after function
                // compilation.
-               if strings.HasPrefix(sym.Name, `"".statictmp_`) {
+               if strings.HasPrefix(sym.Name, `""..stmp_`) {
                        return true
                }
        }