golang/go · error
subprogram DIE low_pc attr is not of class address
Error message
subprogram DIE low_pc attr is not of class address
What it means
Thrown by SubprogLoAndHighPc (dwtest.go:214-217) when the DW_AT_low_pc attribute exists but its class is not ClassAddress. Per DWARF, low_pc must be an address-class attribute; any other class indicates a producer bug or a misread DIE.
Source
Thrown at src/cmd/link/internal/dwtest/dwtest.go:215
}
// SubprogLoAndHighPc returns the values of the lo_pc and high_pc
// attrs of the DWARF DIE subprogdie. For DWARF versions 2-3, both of
// these attributes had to be of class address; with DWARF 4 the rules
// were changed, allowing compilers to emit a high PC attr of class
// constant, where the high PC could be computed by starting with the
// low PC address and then adding in the high_pc attr offset. This
// function accepts both styles of specifying a hi/lo pair, returning
// the values or an error if the attributes are malformed in some way.
func SubprogLoAndHighPc(subprogdie *dwarf.Entry) (lo uint64, hi uint64, err error) {
// The low_pc attr for a subprogram DIE has to be of class address.
lofield := subprogdie.AttrField(dwarf.AttrLowpc)
if lofield == nil {
err = fmt.Errorf("subprogram DIE has no low_pc attr")
return
}
if lofield.Class != dwarf.ClassAddress {
err = fmt.Errorf("subprogram DIE low_pc attr is not of class address")
return
}
if lopc, ok := lofield.Val.(uint64); ok {
lo = lopc
} else {
err = fmt.Errorf("subprogram DIE low_pc not convertible to uint64")
return
}
// For the high_pc value, we'll accept either an address or a constant
// offset from lo pc.
hifield := subprogdie.AttrField(dwarf.AttrHighpc)
if hifield == nil {
err = fmt.Errorf("subprogram DIE has no high_pc attr")
return
}
switch hifield.Class {
case dwarf.ClassAddress:View on GitHub (pinned to b6b368adc5)
Solutions
- Inspect lofield.Class and lofield.Val to understand what class was emitted instead of ClassAddress.
- Treat the DIE as malformed and skip it if it cannot be reconciled with the DWARF spec.
- Report a linker/compiler bug if the binary comes from the Go toolchain and the attribute class is wrong.
Defensive patterns
Strategy: type-guard
Validate before calling
f := subprogdie.AttrField(dwarf.AttrLowpc)
if f == nil || f.Class != dwarf.ClassAddress {
// not an address-class low_pc — skip or report malformed DIE
return 0, 0, nil
} Type guard
func isAddressLowPC(d *dwarf.Entry) bool {
f := d.AttrField(dwarf.AttrLowpc)
return f != nil && f.Class == dwarf.ClassAddress
} Prevention
- Verify AttrField class equals ClassAddress before relying on low_pc.
- Non-conforming DWARF should be skipped, not silently coerced.
When it happens
Trigger: A subprogram DIE whose low_pc was encoded as a constant, block, or reference instead of an address; reading DWARF produced by a non-conforming compiler; re-encoding artifact from the linker.
Common situations: Compiler/linker emits a non-address low_pc (invalid DWARF); binary corruption; reading a DIE intended for a different DWARF consumer.
Related errors
- d.LineReader: %v
- Examiner.FileRef: malformed file reference %d
- subprogram DIE has no low_pc attr
- subprogram DIE low_pc not convertible to uint64
- subprogram DIE has no high_pc attr
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/cfb25b3fd31ddb47.
Report an issue: GitHub.