[cfe-commits] r53737 - /cfe/trunk/lib/CodeGen/CGExprConstant.cpp
Daniel Dunbar
daniel at zuster.org
Thu Jul 17 14:07:49 PDT 2008
Author: ddunbar
Date: Thu Jul 17 16:07:48 2008
New Revision: 53737
URL: http://llvm.org/viewvc/llvm-project?rev=53737&view=rev
Log:
Fix for codegen crash on multibit bool bitfield initialization
<rdar://problem/6078606>
Modified:
cfe/trunk/lib/CodeGen/CGExprConstant.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=53737&r1=53736&r2=53737&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Thu Jul 17 16:07:48 2008
@@ -145,6 +145,13 @@
while (offset < (fieldOffset & -8))
offset += CGM.getTypes().getTargetData().getTypeStoreSizeInBits(Elts[i++]->getType());
+ // Promote the size of V if necessary
+ // FIXME: This should never occur, but currently it can because
+ // initializer constants are cast to bool, and because clang is
+ // not enforcing bitfield width limits.
+ if (bitFieldInfo.Size > V.getBitWidth())
+ V.zext(bitFieldInfo.Size);
+
// Insert the bits into the struct
// FIXME: This algorthm is only correct on X86!
// FIXME: THis algorthm assumes bit-fields only have byte-size elements!
More information about the cfe-commits
mailing list