[LLVMbugs] [Bug 17957] New: DebugLoc will fail if unsigned is 64 bit

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Nov 16 07:36:00 PST 2013


            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: unassignedbugs at nondot.org
          Reporter: yaron.keren at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131116/11ec7911/attachment.html>

More information about the llvm-bugs mailing list