diff --git a/gen/classes.cpp b/gen/classes.cpp index c01906e1..504e6806 100644 --- a/gen/classes.cpp +++ b/gen/classes.cpp @@ -1153,7 +1153,7 @@ llvm::Value* DtoIndexClass(llvm::Value* ptr, ClassDeclaration* cd, Type* t, unsi Type* vdtype = DtoDType(vd->type); //Logger::println("found %u type %s", vd->offset, vdtype->toChars()); assert(vd->ir.irField->index >= 0); - if (os == vd->offset && vdtype == t) { + if (os == vd->offset && vdtype->toBasetype() == t->toBasetype()) { Logger::println("found %s %s", vdtype->toChars(), vd->toChars()); idxs.push_back(vd->ir.irField->index + dataoffset); //Logger::cout() << "indexing: " << *ptr << '\n'; diff --git a/gen/statements.cpp b/gen/statements.cpp index c6180126..8e6e100f 100644 --- a/gen/statements.cpp +++ b/gen/statements.cpp @@ -842,12 +842,13 @@ void ForeachStatement::toIR(IRState* p) llvm::Value* zerokey = llvm::ConstantInt::get(keytype,0,false); // value + Logger::println("value = %s", value->toPrettyChars()); const llvm::Type* valtype = DtoType(value->type); llvm::Value* valvar = NULL; if (!value->isRef() && !value->isOut()) valvar = new llvm::AllocaInst(valtype, "foreachval", p->topallocapoint()); - assert(!value->ir.irLocal); - value->ir.irLocal = new IrLocal(value); + if (!value->ir.irLocal) + value->ir.irLocal = new IrLocal(value); // what to iterate DValue* aggrval = aggr->toElem(p); diff --git a/gen/toir.cpp b/gen/toir.cpp index cd8093bd..37547a1f 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -1246,7 +1246,10 @@ DValue* CastExp::toElem(IRState* p) return v; } - else if (u->isLRValue() || (u->isVar() && u->isVar()->lval)) + else if (DLRValue* lr = u->isLRValue()) + return new DLRValue(lr->getLType(), lr->getLVal(), to, v->getRVal()); + + else if (u->isVar() && u->isVar()->lval) return new DLRValue(e1->type, u->getLVal(), to, v->getRVal()); else if (gIR->topexp() && gIR->topexp()->e1 == this) diff --git a/gen/tollvm.cpp b/gen/tollvm.cpp index 8ccd6715..34d9a2a7 100644 --- a/gen/tollvm.cpp +++ b/gen/tollvm.cpp @@ -1006,11 +1006,16 @@ void DtoAssign(DValue* lhs, DValue* rhs) Logger::cout() << "assign\nlhs: " << *l << "rhs: " << *r << '\n'; const llvm::Type* lit = l->getType()->getContainedType(0); if (r->getType() != lit) { - if (DLRValue* lr = lhs->isLRValue()) // handle lvalue cast assignments + // handle lvalue cast assignments + if (DLRValue* lr = lhs->isLRValue()) { + Logger::println("lvalue cast!"); r = DtoCast(rhs, lr->getLType())->getRVal(); - else + } + else { r = DtoCast(rhs, lhs->getType())->getRVal(); + } Logger::cout() << "really assign\nlhs: " << *l << "rhs: " << *r << '\n'; + assert(r->getType() == l->getType()->getContainedType(0)); } gIR->ir->CreateStore(r, l); } diff --git a/llvmdc-posix-internal b/llvmdc-posix-internal index e3d16766..e866e2fc 100644 --- a/llvmdc-posix-internal +++ b/llvmdc-posix-internal @@ -43,7 +43,7 @@ version=-version=$i [link] -oneatatime=yes +#oneatatime=yes cmd=llvmdc $i -of$o libdir=-L-L$i @@ -53,7 +53,7 @@ flag=-L$i [liblink] safe=yes -oneatatime=yes +#oneatatime=yes cmd=llvm-link -f -o=$o $i libdir= @@ -67,7 +67,7 @@ cmd= [shliblink] shlibs=no -oneatatime=yes +#oneatatime=yes cmd=llvm-link $i | llc -filetype=dynlib -f -o=$o libdir= diff --git a/llvmdc-tango b/llvmdc-tango index fce75875..c83ccfcb 100644 --- a/llvmdc-tango +++ b/llvmdc-tango @@ -7,12 +7,13 @@ exeext= objext=bc +version=LLVM version=LLVMDC noversion=DigitalMars noversion=GNU testversion=linux testversion=Unix -testversion=Posix +version=Posix testversion=Windows testversion=Win32 testversion=Win64 @@ -41,7 +42,7 @@ version=-version=$i [link] -oneatatime=yes +#oneatatime=yes cmd=llvmdc $i -of$o libdir=-L-L=$i @@ -51,7 +52,7 @@ flag=-L$i [liblink] safe=yes -oneatatime=yes +#oneatatime=yes cmd=llvm-ar rsc $o $i libdir=-L=$i