changeset 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 d22d8d63c1fd
children f273f5c58a9a
files gen/arrays.cpp
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
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;