[llvm-commits] [llvm-gcc-4.2] r64731 - /llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-types.cpp

Bill Wendling isanbard at gmail.com
Mon Feb 16 18:53:02 PST 2009


Author: void
Date: Mon Feb 16 20:53:02 2009
New Revision: 64731

URL: http://llvm.org/viewvc/llvm-project?rev=64731&view=rev
Log:
Pull r64510 into Dib:

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/branches/Apple/Dib/gcc/llvm-types.cpp

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-types.cpp?rev=64731&r1=64730&r2=64731&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-types.cpp Mon Feb 16 20:53:02 2009
@@ -2240,6 +2240,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