1
0
mirror of https://github.com/golang/go synced 2024-11-26 07:17:59 -07:00

cmd/compile: fix corner case in DWARF inline info generation

The helper routine for returning pre-inlining parameter declarations
wasn't properly handling the case where you have more than one
parameter named "_" in a function signature; this triggered a map
collision later on when the function was inlined and DWARF was
generated for the inlined routine instance.

Fixes #23179.

Change-Id: I12e5d6556ec5ce08e982a6b53666a4dcc1d22201
Reviewed-on: https://go-review.googlesource.com/84755
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Than McIntosh 2017-12-19 12:08:32 -05:00
parent 3aeb3950a9
commit 0447216316
4 changed files with 30 additions and 1 deletions

View File

@ -599,7 +599,9 @@ func preInliningDcls(fnsym *obj.LSym) []*Node {
}
for _, n := range dcl {
c := n.Sym.Name[0]
if c == '.' || n.Type.IsUntyped() {
// Avoid reporting "_" parameters, since if there are more tham
// one, it can result in a collision later on, as in #23179.
if unversion(n.Sym.Name) == "_" || c == '.' || n.Type.IsUntyped() {
continue
}
rdcl = append(rdcl, n)

View File

@ -0,0 +1,9 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package a
func F(x int, _ int, _ bool) int {
return x
}

View File

@ -0,0 +1,11 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package b
import "a"
func G(x int) int {
return a.F(x, 1, false)
}

View File

@ -0,0 +1,7 @@
// compiledir
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ignored