diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-17 06:53:44 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-17 06:53:44 +0000 |
commit | 7a22f02a02616be8fd817529f1696a88a35ee041 (patch) | |
tree | 056a1d750aa2ba601c704723d63a5927fb07a6c5 /lib/CodeGen/CGExprConstant.cpp | |
parent | fb36d21960a3bd422665a961eac6ca269cd6445b (diff) |
revert r101568, which miscompiles this testcase, distilled from ldecod:
void exit_picture()
{
char yuv_types[4][6]= {"4:0:0","4:2:0","4:2:2","4:4:4"};
foo(yuv_types);
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101623 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprConstant.cpp')
-rw-r--r-- | lib/CodeGen/CGExprConstant.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index 6612070c64..82156f7260 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -615,16 +615,17 @@ public: } llvm::Constant *EmitArrayInitialization(InitListExpr *ILE) { + std::vector<llvm::Constant*> Elts; + const llvm::ArrayType *AType = + cast<llvm::ArrayType>(ConvertType(ILE->getType())); unsigned NumInitElements = ILE->getNumInits(); + // FIXME: Check for wide strings // FIXME: Check for NumInitElements exactly equal to 1?? if (NumInitElements > 0 && (isa<StringLiteral>(ILE->getInit(0)) || - isa<ObjCEncodeExpr>(ILE->getInit(0)))) + isa<ObjCEncodeExpr>(ILE->getInit(0))) && + ILE->getType()->getArrayElementTypeNoTypeQual()->isCharType()) return Visit(ILE->getInit(0)); - - std::vector<llvm::Constant*> Elts; - const llvm::ArrayType *AType = - cast<llvm::ArrayType>(ConvertType(ILE->getType())); const llvm::Type *ElemTy = AType->getElementType(); unsigned NumElements = AType->getNumElements(); |