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>
// 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
// 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
}
}