# HG changeset patch # User ChristianK # Date 1214002495 -7200 # Node ID 9bb48fb57a7d08d7197a3197bf5619191c8563d0 # Parent 74348f16222530c9ff46e080a0e0d8a6a3e9f934 [svn r304] Fix associative array literals by always reserving a zero inited temporary for them. diff -r 74348f162225 -r 9bb48fb57a7d gen/toir.cpp --- a/gen/toir.cpp Sat Jun 21 00:00:56 2008 +0200 +++ b/gen/toir.cpp Sat Jun 21 00:54:55 2008 +0200 @@ -2815,17 +2815,12 @@ Type* aatype = DtoDType(type); Type* vtype = aatype->next; - - DValue* aa; - if (p->topexp() && p->topexp()->e2 == this) - { - aa = p->topexp()->v; - } - else - { - LLValue* tmp = new llvm::AllocaInst(DtoType(type),"aaliteral",p->topallocapoint()); - aa = new DVarValue(type, tmp, true); - } + const LLType* aalltype = DtoType(type); + + // it should be possible to avoid the temporary in some cases + LLValue* tmp = new llvm::AllocaInst(aalltype,"aaliteral",p->topallocapoint()); + DValue* aa = new DVarValue(type, tmp, true); + DtoStore(LLConstant::getNullValue(aalltype), tmp); const size_t n = keys->dim; for (size_t i=0; i