Fix crash on complex constant zero.

Fixes <rdar://problem/14442543>.

llvm-svn: 186452
This commit is contained in:
Eli Friedman 2013-07-16 20:19:04 +00:00
parent c97d83dd3b
commit 64f2391899
2 changed files with 6 additions and 3 deletions

View File

@ -114,9 +114,9 @@ public:
if (result.isReference()) if (result.isReference())
return EmitLoadOfLValue(result.getReferenceLValue(CGF, E)); return EmitLoadOfLValue(result.getReferenceLValue(CGF, E));
llvm::ConstantStruct *pair = llvm::Constant *pair = result.getValue();
cast<llvm::ConstantStruct>(result.getValue()); return ComplexPairTy(pair->getAggregateElement(0U),
return ComplexPairTy(pair->getOperand(0), pair->getOperand(1)); pair->getAggregateElement(1U));
} }
return EmitLoadOfLValue(E); return EmitLoadOfLValue(E);
} }

View File

@ -95,3 +95,6 @@ double t7(double _Complex c) {
void t8() { void t8() {
__complex__ int *x = &(__complex__ int){1}; __complex__ int *x = &(__complex__ int){1};
} }
const _Complex double test9const = 0;
_Complex double test9func() { return test9const; }