[llvm-commits] [dragonegg] r88666 - /dragonegg/trunk/llvm-convert.cpp
Duncan Sands
baldrick at free.fr
Fri Nov 13 10:04:58 PST 2009
Author: baldrick
Date: Fri Nov 13 12:04:58 2009
New Revision: 88666
URL: http://llvm.org/viewvc/llvm-project?rev=88666&view=rev
Log:
Port commits 85303 and 85407 (johannes) from llvm-gcc:
Make previous change not crash when size of object is unknown.
Remove used-uninitialized warning. Add an assert to
make it clearer to humans there is no uninitialized use,
but there's no way a compiler could figure it out.
Modified:
dragonegg/trunk/llvm-convert.cpp
Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=88666&r1=88665&r2=88666&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Fri Nov 13 12:04:58 2009
@@ -7866,10 +7866,12 @@
uint64_t GCCFieldOffsetInBits = getFieldOffsetInBits(Field);
NextField = TREE_CHAIN(Field);
- uint64_t FieldSizeInBits = getInt64(DECL_SIZE(Field), true);
+ uint64_t FieldSizeInBits = 0;
+ if (DECL_SIZE(Field))
+ FieldSizeInBits = getInt64(DECL_SIZE(Field), true);
uint64_t ValueSizeInBits = Val->getType()->getPrimitiveSizeInBits();
ConstantInt *ValC = dyn_cast<ConstantInt>(Val);
- if (ValC && ValC->isZero()) {
+ if (ValC && ValC->isZero() && DECL_SIZE(Field)) {
// G++ has various bugs handling {} initializers where it doesn't
// synthesize a zero node of the right type. Instead of figuring out G++,
// just hack around it by special casing zero and allowing it to be the
@@ -7893,6 +7895,7 @@
// Bitfields can only be initialized with constants (integer constant
// expressions).
assert(ValC);
+ assert(DECL_SIZE(Field));
assert(ValueSizeInBits >= FieldSizeInBits &&
"disagreement between LLVM and GCC on bitfield size");
if (ValueSizeInBits != FieldSizeInBits) {
More information about the llvm-commits
mailing list