[llvm-commits] [llvm-gcc-4.2] r93053 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Duncan Sands baldrick at free.fr
Sat Jan 9 08:56:50 PST 2010


Author: baldrick
Date: Sat Jan  9 10:56:50 2010
New Revision: 93053

URL: http://llvm.org/viewvc/llvm-project?rev=93053&view=rev
Log:
Dump details of the problematic type when the GCC and LLVM
type sizes fail to match.

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=93053&r1=93052&r2=93053&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Sat Jan  9 10:56:50 2010
@@ -73,14 +73,18 @@
 
 // Note down LLVM type for GCC tree node.
 static const Type * llvm_set_type(tree Tr, const Type *Ty) {
-
+#ifndef NDEBUG
   // For x86 long double, llvm records the size of the data (80) while
   // gcc's TYPE_SIZE including alignment padding.  getTypeAllocSizeInBits
   // is used to compensate for this.
-  assert((!TYPE_SIZE(Tr) || !Ty->isSized() || !isInt64(TYPE_SIZE(Tr), true) ||
-         getInt64(TYPE_SIZE(Tr), true) == 
-            getTargetData().getTypeAllocSizeInBits(Ty))
-         && "LLVM type size doesn't match GCC type size!");
+  if (TYPE_SIZE(Tr) && Ty->isSized() && isInt64(TYPE_SIZE(Tr), true) &&
+      getInt64(TYPE_SIZE(Tr), true) !=
+      getTargetData().getTypeAllocSizeInBits(Ty)) {
+    errs() << "LLVM type size doesn't match GCC type size!\n";
+    debug_tree(Tr);
+    abort();
+  }
+#endif
 
   unsigned &TypeSlot = LTypesMap[Ty];
   if (TypeSlot) {





More information about the llvm-commits mailing list