[libcxxabi] r228357 - Silence warning about loss of precision

Saleem Abdulrasool compnerd at compnerd.org
Thu Feb 5 15:27:37 PST 2015


Author: compnerd
Date: Thu Feb  5 17:27:36 2015
New Revision: 228357

URL: http://llvm.org/viewvc/llvm-project?rev=228357&view=rev
Log:
Silence warning about loss of precision

Explicitly cast to uintptr_t before casting to a 32-bit value.  Because this
code path is meant to be used in a 32-bit address space, this truncation should
be safe.

Unwind-EHABI.h:25:12: error: cast from pointer to smaller type 'uint32_t' (aka 'unsigned int') loses information

Modified:
    libcxxabi/trunk/src/Unwind/Unwind-EHABI.h

Modified: libcxxabi/trunk/src/Unwind/Unwind-EHABI.h
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/Unwind-EHABI.h?rev=228357&r1=228356&r2=228357&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/Unwind-EHABI.h (original)
+++ libcxxabi/trunk/src/Unwind/Unwind-EHABI.h Thu Feb  5 17:27:36 2015
@@ -22,7 +22,7 @@ static inline uint32_t signExtendPrel31(
 }
 
 static inline uint32_t readPrel31(const uint32_t *data) {
-  return (((uint32_t) data) + signExtendPrel31(*data));
+  return (((uint32_t)(uintptr_t)data) + signExtendPrel31(*data));
 }
 
 #if defined(__cplusplus)





More information about the cfe-commits mailing list