[llvm-commits] [dragonegg] r147850 - /dragonegg/trunk/src/Types.cpp

Duncan Sands baldrick at free.fr
Tue Jan 10 04:51:02 PST 2012


Author: baldrick
Date: Tue Jan 10 06:51:02 2012
New Revision: 147850

URL: http://llvm.org/viewvc/llvm-project?rev=147850&view=rev
Log:
Do not crash when converting an array of opaque struct type (the LLVM
type is then not sized, so trying to get its alignment fails).  Partially
fixes the failure to compile array1.C from the gcc testsuite.

Modified:
    dragonegg/trunk/src/Types.cpp

Modified: dragonegg/trunk/src/Types.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Types.cpp?rev=147850&r1=147849&r2=147850&view=diff
==============================================================================
--- dragonegg/trunk/src/Types.cpp (original)
+++ dragonegg/trunk/src/Types.cpp Tue Jan 10 06:51:02 2012
@@ -497,7 +497,7 @@
   Type *Ty = ArrayType::get(ElementTy, NumElements);
 
   // If the array is underaligned, wrap it in a packed struct.
-  if (TYPE_ALIGN(type) < getTargetData().getABITypeAlignment(Ty) * 8)
+  if (TYPE_ALIGN(type) < TYPE_ALIGN(TREE_TYPE(type)))
     Ty = StructType::get(Context, Ty, /*isPacked*/ true);
 
   // If the user increased the alignment of the array element type, then the





More information about the llvm-commits mailing list