[LLVMbugs] [Bug 20441] New: Pointer isn't properly casted to uint64_t

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 24 14:00:06 PDT 2014


            Bug ID: 20441
           Summary: Pointer isn't properly casted to uint64_t
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: hjl.tools at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

There are codes like

void *Addr;
... (uint64_t)Addr ...

When pointer size is 32 bits and pointer value is >= 2GB, pointer value is
sign-extended to 64 bits, i.e.:

(void*) 0xf0000000 -> (int) 0xf0000000 -> (int64) 0xfffffffff0000000 ->
(uint64) 0xfffffffff0000000

It should be casted to uintptr_t first, (uint64_t)(uintptr_t)Addr:

(void*) 0xf0000000 -> (uint) 0xf0000000 -> (uint64) 0x00000000f0000000

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/20140724/eea40752/attachment.html>

More information about the llvm-bugs mailing list