1
0
mirror of https://github.com/golang/go synced 2024-11-24 05:30:24 -07:00
go/test/fixedbugs/issue22941.dir/b.go
Than McIntosh 9372166faa cmd/compile: fix DWARF type symbol buglet
The code that generates the list of DWARF variables for a function
(params and autos) will emit a "no-location" entry in the DWARF for a
user var that appears in the original pre-optimization version of the
function but is no longer around when optimization is complete. The
intent is that if a GDB user types "print foo" (where foo has been
optimized out), the response will be "<optimized out>" as opposed to
"there is no such variable 'foo'). This change fixes said code to
include vars on the autom list for the function, to insure that the
type symbol for the variable makes it to the linker.

Fixes #22941.

Change-Id: Id29f1f39d68fbb798602dfd6728603040624fc41
Reviewed-on: https://go-review.googlesource.com/81415
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-12-01 18:52:50 +00:00

31 lines
431 B
Go

// 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 p
import q "./a"
type T struct {
X *q.P
}
func F(in, out *T) {
*out = *in
if in.X != nil {
in, out := &in.X, &out.X
if *in == nil {
*out = nil
} else {
*out = new(q.P)
**out = **in
}
}
return
}
//go:noinline
func G(x, y *T) {
F(x, y)
}