[cfe-commits] r71197 - in /cfe/branches/Apple/Dib: lib/CodeGen/CGExprConstant.cpp test/CodeGen/bitfield-init.c
Mike Stump
mrs at apple.com
Thu May 7 17:06:40 PDT 2009
Author: mrs
Date: Thu May 7 19:06:40 2009
New Revision: 71197
URL: http://llvm.org/viewvc/llvm-project?rev=71197&view=rev
Log:
Merge in 71194:
Fix crash with constant initialization of bit-fields in unions.
Modified:
cfe/branches/Apple/Dib/lib/CodeGen/CGExprConstant.cpp
cfe/branches/Apple/Dib/test/CodeGen/bitfield-init.c
Modified: cfe/branches/Apple/Dib/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/CodeGen/CGExprConstant.cpp?rev=71197&r1=71196&r2=71197&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/branches/Apple/Dib/lib/CodeGen/CGExprConstant.cpp Thu May 7 19:06:40 2009
@@ -275,7 +275,7 @@
if (curField->isBitField()) {
// Create a dummy struct for bit-field insertion
- unsigned NumElts = CGM.getTargetData().getTypePaddedSize(Ty) / 8;
+ unsigned NumElts = CGM.getTargetData().getTypePaddedSize(Ty);
llvm::Constant* NV = llvm::Constant::getNullValue(llvm::Type::Int8Ty);
std::vector<llvm::Constant*> Elts(NumElts, NV);
Modified: cfe/branches/Apple/Dib/test/CodeGen/bitfield-init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/CodeGen/bitfield-init.c?rev=71197&r1=71196&r2=71197&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/test/CodeGen/bitfield-init.c (original)
+++ cfe/branches/Apple/Dib/test/CodeGen/bitfield-init.c Thu May 7 19:06:40 2009
@@ -10,3 +10,5 @@
struct Token one = { 1 };
}
+typedef union T0 { char field0 : 2; } T0;
+T0 T0_values = { 0 };
More information about the cfe-commits
mailing list