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())
return EmitLoadOfLValue(result.getReferenceLValue(CGF, E));
llvm::ConstantStruct *pair =
cast<llvm::ConstantStruct>(result.getValue());
return ComplexPairTy(pair->getOperand(0), pair->getOperand(1));
llvm::Constant *pair = result.getValue();
return ComplexPairTy(pair->getAggregateElement(0U),
pair->getAggregateElement(1U));
}
return EmitLoadOfLValue(E);
}

View File

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