mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: emit DIEs for zero sized variables
Fixes the compiler to emit DIEs for zero sized variables. Fixes #54615 Change-Id: I1e0c86a97f1abcc7edae516b6a7fe35bcb65ed0f Reviewed-on: https://go-review.googlesource.com/c/go/+/433479 Reviewed-by: Damien Neil <dneil@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
77296e3645
commit
e59d873ff9
4 changed files with 71 additions and 0 deletions
|
|
@ -151,6 +151,21 @@ func createDwarfVars(fnsym *obj.LSym, complexOK bool, fn *ir.Func, apDecls []*ir
|
|||
} else {
|
||||
decls, vars, selected = createSimpleVars(fnsym, apDecls)
|
||||
}
|
||||
if fn.DebugInfo != nil {
|
||||
// Recover zero sized variables eliminated by the stackframe pass
|
||||
for _, n := range fn.DebugInfo.(*ssa.FuncDebug).OptDcl {
|
||||
if n.Class != ir.PAUTO {
|
||||
continue
|
||||
}
|
||||
types.CalcSize(n.Type())
|
||||
if n.Type().Size() == 0 {
|
||||
decls = append(decls, n)
|
||||
vars = append(vars, createSimpleVar(fnsym, n))
|
||||
vars[len(vars)-1].StackOffset = 0
|
||||
fnsym.Func().RecordAutoType(reflectdata.TypeLinksym(n.Type()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dcl := apDecls
|
||||
if fnsym.WasInlined() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue