Fixed crashes when compiling interpret test.

This commit is contained in:
Alexey Prokhin 2010-12-17 12:55:28 +03:00
parent f5f5c2e1f9
commit eccd26ac93
4 changed files with 15 additions and 6 deletions

View file

@ -75,7 +75,7 @@ void DtoArrayInit(Loc& loc, DValue* array, DValue* value)
LLValue* val; LLValue* val;
// give slices and complex values storage (and thus an address to pass) // give slices and complex values storage (and thus an address to pass)
if (value->isSlice()) if (value->isSlice() || value->type->ty == Tdelegate)
{ {
val = DtoAlloca(value->getType(), ".tmpparam"); val = DtoAlloca(value->getType(), ".tmpparam");
DVarValue lval(value->getType(), val); DVarValue lval(value->getType(), val);

View file

@ -13,11 +13,15 @@
DVarValue::DVarValue(Type* t, VarDeclaration* vd, LLValue* llvmValue) DVarValue::DVarValue(Type* t, VarDeclaration* vd, LLValue* llvmValue)
: DValue(t), var(vd), val(llvmValue) : DValue(t), var(vd), val(llvmValue)
{} {
assert(isaPointer(llvmValue));
}
DVarValue::DVarValue(Type* t, LLValue* llvmValue) DVarValue::DVarValue(Type* t, LLValue* llvmValue)
: DValue(t), var(0), val(llvmValue) : DValue(t), var(0), val(llvmValue)
{} {
assert(isaPointer(llvmValue));
}
LLValue* DVarValue::getLVal() LLValue* DVarValue::getLVal()
{ {

View file

@ -356,10 +356,14 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
// ... or a nested function context arg // ... or a nested function context arg
else if (nestedcall) else if (nestedcall)
{ {
if (dfnval) {
LLValue* contextptr = DtoNestedContext(loc, dfnval->func); LLValue* contextptr = DtoNestedContext(loc, dfnval->func);
contextptr = DtoBitCast(contextptr, getVoidPtrType()); contextptr = DtoBitCast(contextptr, getVoidPtrType());
++argiter;
args.push_back(contextptr); args.push_back(contextptr);
} else {
args.push_back(llvm::UndefValue::get(getVoidPtrType()));
}
++argiter;
} }
else else
{ {

View file

@ -31,6 +31,7 @@ IrGlobal::IrGlobal(VarDeclaration* v): IrVar(v),
IrLocal::IrLocal(VarDeclaration* v) : IrVar(v) IrLocal::IrLocal(VarDeclaration* v) : IrVar(v)
{ {
nestedIndex = -1; nestedIndex = -1;
byref = false;
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////