mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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/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>
This commit is contained in:
parent
2cdebb5174
commit
08831b150c
2 changed files with 2 additions and 2 deletions
|
|
@ -568,7 +568,7 @@ var statuniqgen int // name generator for static temps
|
||||||
// returned node for readonly nodes.
|
// returned node for readonly nodes.
|
||||||
func staticname(t *types.Type) *Node {
|
func staticname(t *types.Type) *Node {
|
||||||
// Don't use lookupN; it interns the resulting string, but these are all unique.
|
// 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++
|
statuniqgen++
|
||||||
addvar(n, t, PEXTERN)
|
addvar(n, t, PEXTERN)
|
||||||
return n
|
return n
|
||||||
|
|
|
||||||
|
|
@ -439,7 +439,7 @@ func IsSanitizerSafeAddr(v *Value) bool {
|
||||||
// test sym.Type==objabi.SRODATA, but we don't
|
// test sym.Type==objabi.SRODATA, but we don't
|
||||||
// initialize sym.Type until after function
|
// initialize sym.Type until after function
|
||||||
// compilation.
|
// compilation.
|
||||||
if strings.HasPrefix(sym.Name, `"".statictmp_`) {
|
if strings.HasPrefix(sym.Name, `""..stmp_`) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue