[llvm-commits] [llvm-gcc-4.2] r64510 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Dale Johannesen
dalej at apple.com
Fri Feb 13 16:18:43 PST 2009
Author: johannes
Date: Fri Feb 13 18:18:43 2009
New Revision: 64510
URL: http://llvm.org/viewvc/llvm-project?rev=64510&view=rev
Log:
Fix a bug handling zero-length fields in unions.
Exposed by 64234, but it was always there if the
zero-length field was the only one in the union.
g{cc,++}.dg/compat/struct-layout-1.exp [several]
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=64510&r1=64509&r2=64510&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Fri Feb 13 18:18:43 2009
@@ -2239,6 +2239,13 @@
continue;
tree TheGccTy = TREE_TYPE(Field);
+
+ // Skip zero-length fields; ConvertType refuses to construct a type
+ // of size 0.
+ if (DECL_SIZE(Field) &&
+ TREE_CODE(DECL_SIZE(Field))==INTEGER_CST &&
+ TREE_INT_CST_LOW(DECL_SIZE(Field))==0)
+ continue;
#ifdef TARGET_POWERPC
// Normally gcc reduces the size of bitfields to the size necessary
// to hold the bits, e.g. a 1-bit field becomes QI. It does not do
More information about the llvm-commits
mailing list