{"record":{"id":"383efd2e8e16aad2","repo":"golang/go","slug":"dwarf-null-reference-in-d","errorCode":null,"errorMessage":"dwarf: null reference in %d","messagePattern":"dwarf: null reference in (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/internal/dwarf/dwarf.go","lineNumber":978,"sourceCode":"\t\t// TODO(ribrdb): verify padded strings are never used and remove this\n\t\tfor i := int64(len(str)); i < value; i++ {\n\t\t\tctxt.AddInt(s, 1, 0)\n\t\t}\n\n\tcase DW_FORM_flag: // flag\n\t\tif value != 0 {\n\t\t\tctxt.AddInt(s, 1, 1)\n\t\t} else {\n\t\t\tctxt.AddInt(s, 1, 0)\n\t\t}\n\n\t// As of DWARF 3 the ref_addr is always 32 bits, unless emitting a large\n\t// (> 4 GB of debug info aka \"64-bit\") unit, which we don't implement.\n\tcase DW_FORM_ref_addr: // reference to a DIE in the .info section\n\t\tfallthrough\n\tcase DW_FORM_sec_offset: // offset into a DWARF section other than .info\n\t\tif data == nil {\n\t\t\treturn fmt.Errorf(\"dwarf: null reference in %d\", abbrev)\n\t\t}\n\t\tctxt.AddDWARFAddrSectionOffset(s, data, value)\n\n\tcase DW_FORM_addrx: // index into .debug_addr section\n\t\tctxt.AddIndirectTextRef(s, data)\n\n\tcase DW_FORM_ref1, // reference within the compilation unit\n\t\tDW_FORM_ref2,      // reference\n\t\tDW_FORM_ref4,      // reference\n\t\tDW_FORM_ref8,      // reference\n\t\tDW_FORM_ref_udata, // reference\n\n\t\tDW_FORM_strp,     // string\n\t\tDW_FORM_indirect: // (see Section 7.5.3)\n\t\tfallthrough\n\tdefault:\n\t\treturn fmt.Errorf(\"dwarf: unsupported attribute form %d / class %d\", form, cls)\n\t}","sourceCodeStart":960,"sourceCodeEnd":996,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/dwarf/dwarf.go#L960-L996","documentation":"Returned by putattr when handling DW_FORM_ref_addr or DW_FORM_sec_offset with a nil `data` argument. These forms emit an offset into another DWARF section via ctxt.AddDWARFAddrSectionOffset(s, data, value); a nil data means there is no referenced section, which the DWARF emitter treats as a hard error rather than emit a bogus offset.","triggerScenarios":"The DWARF abbreviation table routes an attribute through DW_FORM_ref_addr/DW_FORM_sec_offset but the caller passed nil for the section reference. This is an internal compiler/linker state bug — the abbreviation's form/class disagrees with the supplied data — rather than a user-input error.","commonSituations":"Encountered when the compiler emits DWARF for unusual constructs (e.g. abstract/concrete inlined functions, cross-CU references) and an abbreviation/form mismatch slips in, typically after a compiler change or on bleeding-edge tip builds. Almost never triggerable by end-user Go source.","solutions":["Rebuild with a stable Go release rather than tip; this is usually a toolchain regression.","File an issue at https://go.dev/issue with the reproducer package and `go version`.","Try simplifying the offending package (split large files, remove heavy generics/inlining) to dodge the triggering DIE.","Temporarily build with `-ldflags=-w` to suppress DWARF and confirm the binary links without it."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use released Go toolchains for production builds; avoid tip for DWARF-sensitive work.","If you control the build, pass -ldflags=-w to skip DWARF when not needed.","Report internal DWARF invariant violations upstream with a reproducer."],"tags":["dwarf","compiler","linker","debug-info","internal"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}