golang/go · error

subprogram DIE high_pc unknown value class %s

Error message

subprogram DIE high_pc unknown value class %s

What it means

In the Go linker's DWARF validation (dwtest), this error fires when a subprogram DIE's high_pc attribute has a DWARF class that is neither ClassAddress nor ClassConstant. The DWARF standard only permits these two forms for high_pc. Any other class (e.g. ClassExprLoc, ClassBlock, ClassStrp) indicates non-conformant or experimental DWARF data.

Source

Thrown at src/cmd/link/internal/dwtest/dwtest.go:248

		return
	}
	switch hifield.Class {
	case dwarf.ClassAddress:
		if hipc, ok := hifield.Val.(uint64); ok {
			hi = hipc
		} else {
			err = fmt.Errorf("subprogram DIE high not convertible to uint64")
			return
		}
	case dwarf.ClassConstant:
		if hioff, ok := hifield.Val.(int64); ok {
			hi = lo + uint64(hioff)
		} else {
			err = fmt.Errorf("subprogram DIE high_pc not convertible to uint64")
			return
		}
	default:
		err = fmt.Errorf("subprogram DIE high_pc unknown value class %s",
			hifield.Class)
	}
	return
}

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Report as a Go toolchain issue with the class name and reproducer
  2. Clean rebuild from scratch: go clean -cache && go build
  3. If using cgo, check whether C object files have non-standard DWARF (strip debug info from C objects with -s if needed)
  4. Try a different Go version to isolate the regression
Defensive patterns

Strategy: validation

Validate before calling

// Validate high_pc class before processing
func isValidHighPCClass(c dwarf.Class) bool {
    return c == dwarf.ClassAddress || c == dwarf.ClassConstant
}

// Usage:
field := die.AttrField(dwarf.AttrHighpc)
if field != nil && !isValidHighPCClass(field.Class) {
    log.Printf("unsupported high_pc class %s, skipping", field.Class)
    continue
}

Prevention

When it happens

Trigger: The dwtest validator's switch on hifield.Class falls through to the default case, printing the actual class name via the %s format verb. This happens when a DWARF producer emits an unsupported encoding form for the high_pc attribute.

Common situations: Object files produced by a non-Go compiler linked via cgo that emits non-standard DWARF; experimental Go toolchain changes that introduce new DWARF classes; corrupted or truncated DWARF sections in object files.

Related errors


AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12). Data as JSON: /api/errors/67bb4c342032e559. Report an issue: GitHub.