[llvm-commits] [llvm-gcc-4.2] r85303 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Dale Johannesen
dalej at apple.com
Tue Oct 27 13:56:49 PDT 2009
Author: johannes
Date: Tue Oct 27 15:56:49 2009
New Revision: 85303
URL: http://llvm.org/viewvc/llvm-project?rev=85303&view=rev
Log:
Make previous change not crash when size of object is unknown.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=85303&r1=85302&r2=85303&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Oct 27 15:56:49 2009
@@ -7774,10 +7774,12 @@
uint64_t GCCFieldOffsetInBits = getFieldOffsetInBits(Field);
NextField = TREE_CHAIN(Field);
- uint64_t FieldSizeInBits = getInt64(DECL_SIZE(Field), true);
+ uint64_t FieldSizeInBits;
+ 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
More information about the llvm-commits
mailing list