-
Than McIntosh authored
Fix a problem in DWARF inline debug generation relating to handling of statically unreachable local variables. For a function such as: const always = true func HasDeadLocal() int { if always { return 9 } x := new(Something) ... return x.y } the variable "x" is placed onto the Dcl list for the function during parsing, but the actual declaration node is deleted later on when gc.Main invokes "deadcode". Later in the compile the DWARF code emits an abstract function with "x" (since "x" was on the Dcl list at the point of the inline), but the export data emitted does not contain "x". This then creates clashing/inconsistant DWARF abstract function DIEs later on if HasDeadLocal is inlined in somewhere else. As a fix, the inliner now pruned away variables such as "x" when creating a copy of the Dcl list as part of the inlining; this means that both the export data generator and the DWARF emitter wind up seeing a consistent picture. Fixes #25459 Change-Id: I753dc4e9f9ec694340adba5f43c907ba8cc9badc Reviewed-on: https://go-review.googlesource.com/114090 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
1ba26a33