https://bugs.llvm.org/show_bug.cgi?id=43525

            Bug ID: 43525
           Summary: 64-bit call site value immediate is truncated
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedb...@nondot.org
          Reporter: david.stenb...@ericsson.com
                CC: jdevliegh...@apple.com, keith.wal...@arm.com,
                    llvm-bugs@lists.llvm.org,
                    paul_robin...@playstation.sony.com

When compiling the following test program:

  #include <stdint.h>

  extern void foo(uint64_t);

  int main() {
    foo(UINT64_C(0x1122334455667788));
    return 0;
  }

using:

  clang -O1 -g -Xclang -femit-debug-entry-values -c call.c

the call site value for the 64-bit parameter is truncated to 32 bits:

  0x00000064:       DW_TAG_GNU_call_site_parameter
                      DW_AT_location    (DW_OP_reg5 RDI)
                      DW_AT_GNU_call_site_value (DW_OP_constu 0x55667788)

The truncation happens in collectCallSiteParameters():

  if (auto ParamValue = TII->describeLoadedValue(*I)) {
    if (ParamValue->first->isImm()) {
      unsigned Val = ParamValue->first->getImm(); <---------------
      DbgValueLoc DbgLocVal(ParamValue->second, Val);
      finishCallSiteParam(DbgLocVal, Reg);
  [...]

DbgValueLoc takes a int64_t immediate, so if I change Val to a int64_t, the
correct value is emitted:

  0x00000064:       DW_TAG_GNU_call_site_parameter
                      DW_AT_location    (DW_OP_reg5 RDI)
                      DW_AT_GNU_call_site_value (DW_OP_constu
0x1122334455667788)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to