Author: asl Date: Thu Aug 2 19:05:05 2007 New Revision: 40770 URL: http://llvm.org/viewvc/llvm-project?rev=40770&view=rev Log: Another CONSTRUCTOR-related fix
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=40770&r1=40769&r2=40770&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Aug 2 19:05:05 2007 @@ -5777,7 +5777,11 @@ } Constant *TreeConstantToLLVM::ConvertCONSTRUCTOR(tree exp) { - if (CONSTRUCTOR_ELTS(exp) == 0) // All zeros? + // Please note, that we can have empty ctor, even if array is non-trivial (has + // nonzero number of entries). This situation is typical for static ctors, + // when array is filled during program initialization. + if (CONSTRUCTOR_ELTS(exp) == 0 || + VEC_length(constructor_elt, CONSTRUCTOR_ELTS(exp)) == 0) // All zeros? return Constant::getNullValue(ConvertType(TREE_TYPE(exp))); switch (TREE_CODE(TREE_TYPE(exp))) { _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits