[llvm] [Dwarf] Don't crash in dwarf::isC() on vendor-defined languages (PR #223739)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 02:18:39 PDT 2026


================
@@ -0,0 +1,26 @@
+; DW_LANG_lo_user and DW_LANG_hi_user are enumerated by dwarf::isC(), but the
+; vendor-defined codes between them are not, and used to fall through to the
+; trailing llvm_unreachable. Emitting a prototyped subprogram in such a
+; language calls isC() and must not crash.
+
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t.o < %s
+; RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %s
+
+; CHECK: DW_TAG_compile_unit
+; CHECK:   DW_AT_language (0x8003)
+
+define void @f() !dbg !4 {
+  ret void
+}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!2, !3}
+
+; 32771 == DW_LANG_lo_user (0x8000) + 3, a vendor-defined source language.
----------------
jh7370 wrote:

Is it possible to also have a source language that is outside the vendor-defined range that isn't otherwise recognised? I guess it would mean renaming and parameterising the test (maybe by doing `sed` with a couple of different values to achieve the latter).

https://github.com/llvm/llvm-project/pull/223739


More information about the llvm-commits mailing list