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

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 2 08:09:48 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
----------------
firmiana402 wrote:

The `DW_OP_implicit_value` opcode takes two operands. The first operand is ULEB128-encoded and specifies the size in bytes of the second operand — that's the `[0x6]` here. The second operand is in block form, and its length is determined by the first operand — that's the `[0x01 0x00 0x00 0x00 0x00 0x00]` (6 bytes). So there are 7 bytes in total.

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


More information about the llvm-commits mailing list