http://llvm.org/bugs/show_bug.cgi?id=17957

            Bug ID: 17957
           Summary: DebugLoc will fail if unsigned is 64 bit
           Product: new-bugs
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

DebugLoc defines LineCol as 32 bit in comment but unsigned in code:

    /// LineCol - This 32-bit value encodes the line and column number for the
    /// location, encoded as 24-bits for line and 8 bits for col.  A value of 0
    /// for either means unknown.
    unsigned LineCol;

The line extraction function getLine really depends on LineCol being 32 bit:

    unsigned getLine() const {
      return (LineCol << 8) >> 8;  // Mask out column.
    }

This can be fixed either by making 

    uint32_t LineCol;

or by modifying the function to read:

    unsigned getLine() const {
      return (LineCol & 0xFFFFFF);  // Mask out column.
    }

I'm not sure which is the better approach and I can't really test this (no
system with 64 bit unsigned) so I did not submit a patch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to