mirror of
https://github.com/golang/go
synced 2024-11-23 21:30:08 -07: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
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user