Mercurial > projects > ldc
diff gen/arrays.cpp @ 350:b85cf5faccfc trunk
[svn r371] Fixed array init was still broken for immediate slices and complex values.
author | lindquist |
---|---|
date | Mon, 14 Jul 2008 01:03:53 +0200 |
parents | 351c0077d0b3 |
children | 9c9544fd769d |
line wrap: on
line diff
--- a/gen/arrays.cpp Sun Jul 13 21:41:45 2008 +0200 +++ b/gen/arrays.cpp Mon Jul 14 01:03:53 2008 +0200 @@ -113,7 +113,20 @@ 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<LLValue*, 4> args;