Commit 08831b15 authored by Alessandro Arzilli's avatar Alessandro Arzilli Committed by Brad Fitzpatrick

cmd/compile: avoid collisions between statictmps and user vars

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/142497Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 2cdebb51
......@@ -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
......
......@@ -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
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment