golang/go · error

subprogram DIE high_pc not convertible to uint64

Error message

subprogram DIE high_pc not convertible to uint64

What it means

In the Go linker's DWARF validation (dwtest), this error fires when a subprogram DIE's high_pc attribute is classified as ClassConstant (a constant offset relative to low_pc) but its value fails the int64 type assertion. The DWARF standard specifies ClassConstant high_pc as a signed offset from the low_pc address; a non-int64 value indicates malformed debug info.

Source

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

	// 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:
		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 bug with reproducer at https://github.com/golang/go/issues
  2. Clean rebuild: go clean -cache && go build
  3. Verify all transitively imported packages were compiled with the same Go toolchain
  4. Try a stable Go release if using a development version
Defensive patterns

Strategy: try-catch

Type guard

// Type guard for DWARF high_pc ClassConstant value
func isHighPCConstantValue(v interface{}) bool {
    _, ok := v.(int64)
    return ok
}

Try / catch

// Handle the constant-offset high_pc case gracefully
switch hifield.Class {
case dwarf.ClassConstant:
    hioff, ok := hifield.Val.(int64)
    if !ok {
        log.Printf("unexpected high_pc constant type: %T", hifield.Val)
        continue
    }
    hi = lo + uint64(hioff)
}

Prevention

When it happens

Trigger: The dwtest validator checks hifield.Class == dwarf.ClassConstant, then performs hifield.Val.(int64). If the assertion fails because the value is uint64, int, or another type, the error is returned. The intended computation is hi = lo + uint64(hioff).

Common situations: Linker bug in DWARF constant-offset emission; object files from a different Go version that uses a different integer type for DWARF constants; DWARF producer that emits unsigned constants where signed are expected.

Related errors


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