[llvm] [DebugInfo] Truncate implicit value constants to source type width (PR #206671)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 2 07:53:10 PDT 2026


================
@@ -0,0 +1,38 @@
+; RUN: llc -mtriple=i386-unknown-linux-gnu -filetype=obj %s -o - | llvm-dwarfdump -v -debug-info - | FileCheck %s
+
+; A constant debug value may use a carrier integer whose bits do not fit in the
+; declared source type. When emitting source-sized DW_OP_implicit_value bytes,
+; truncate the carrier value to the source type instead of asserting.
+
+; CHECK: DW_TAG_variable
+; CHECK-NEXT: DW_AT_location
+; CHECK: DW_OP_implicit_value 0x6 0x01 0x00 0x00 0x00 0x00 0x00
----------------
OCHyams wrote:

I'm probably missing something obvious but shouldn't this be 6 bytes rather than 7 for the source type of 48 bits? (`!7 = !DIBasicType(name: "unsigned _BitInt(48)", size: 48, encoding: DW_ATE_unsigned)`)

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


More information about the llvm-commits mailing list