[llvm] r174826 - hopefully "really" fix a type punning warning by defining the buffer as

Chris Lattner sabre at nondot.org
Sat Feb 9 22:07:17 PST 2013


Author: lattner
Date: Sun Feb 10 00:07:16 2013
New Revision: 174826

URL: http://llvm.org/viewvc/llvm-project?rev=174826&view=rev
Log:
hopefully "really" fix a type punning warning by defining the buffer as
type char, which can't have TBAA tags.

Modified:
    llvm/trunk/include/llvm/Bitcode/BitstreamReader.h

Modified: llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamReader.h?rev=174826&r1=174825&r2=174826&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/BitstreamReader.h (original)
+++ llvm/trunk/include/llvm/Bitcode/BitstreamReader.h Sun Feb 10 00:07:16 2013
@@ -364,12 +364,13 @@ public:
     uint32_t R = uint32_t(CurWord);
 
     // Read the next word from the stream.
-    uint8_t buf[sizeof(word_t)] = {0};
-    BitStream->getBitcodeBytes().readBytes(NextChar, sizeof(buf), buf, NULL);
+    char buf[sizeof(word_t)] = {0};
+    BitStream->getBitcodeBytes().readBytes(NextChar, sizeof(buf),
+                                           (uint8_t*)buf, NULL);
     
     typedef support::detail::packed_endian_specific_integral
        <word_t, support::little, support::unaligned> Endian_T;
-    CurWord = *(Endian_T*)(void*)buf;
+    CurWord = *(Endian_T*)buf;
 
     NextChar += sizeof(word_t);
 





More information about the llvm-commits mailing list