From ee5d84a1fa1e07d425bb307cc37d5f063f29ea5c Mon Sep 17 00:00:00 2001 From: Tomas Lindquist Olsen Date: Mon, 14 Jul 2008 01:03:53 +0200 Subject: [PATCH] [svn r371] Fixed array init was still broken for immediate slices and complex values. --- gen/arrays.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gen/arrays.cpp b/gen/arrays.cpp index 3b0bfbc0..4491875b 100644 --- a/gen/arrays.cpp +++ b/gen/arrays.cpp @@ -113,7 +113,20 @@ void DtoArrayInit(DValue* array, DValue* value) LLValue* dim = DtoArrayLen(array); LLValue* ptr = DtoArrayPtr(array); - LLValue* val = value->getRVal(); + LLValue* val; + + // give slices and complex values storage (and thus an address to pass) + if (value->isSlice() || value->isComplex()) + { + val = new llvm::AllocaInst(DtoType(value->getType()), ".tmpparam", gIR->topallocapoint()); + DVarValue lval(value->getType(), val, true); + DtoAssign(&lval, value); + } + else + { + val = value->getRVal(); + } + assert(val); // prepare runtime call LLSmallVector args;