Fix bad signature in call to _d_arraysetctor / _d_arraysetassign.

The count parameter is int, not size_t.
This commit is contained in:
Kai Nacke 2015-03-24 20:06:55 +01:00
parent 09ee1ed027
commit ae4344714c
2 changed files with 8 additions and 3 deletions

View file

@ -234,8 +234,13 @@ void DtoArraySetAssign(Loc& loc, DValue *array, DValue *value, int op)
assert(array && value); assert(array && value);
assert(op != TOKblit); assert(op != TOKblit);
LLValue *ptr = DtoArrayPtr(array); LLValue* ptr = DtoArrayPtr(array);
LLValue *len = DtoArrayLen(array); LLValue* len = DtoArrayLen(array);
// The count parameter is of type int but len is of type size_t.
// If size_t is not int then truncated the value.
LLType* intType = LLType::getInt32Ty(gIR->context());
if (len->getType() != intType)
len = gIR->ir->CreateTrunc(len, intType);
LLFunction* fn = LLVM_D_GetRuntimeFunction(loc, gIR->module, op == TOKconstruct ? "_d_arraysetctor" : "_d_arraysetassign"); LLFunction* fn = LLVM_D_GetRuntimeFunction(loc, gIR->module, op == TOKconstruct ? "_d_arraysetctor" : "_d_arraysetassign");
LLValue* args[] = { LLValue* args[] = {

View file

@ -629,7 +629,7 @@ static void LLVM_D_BuildRuntimeModule()
} }
// void* _d_arraysetassign(void* p, void* value, int count, TypeInfo ti) // void* _d_arraysetassign(void* p, void* value, int count, TypeInfo ti)
// void* _d_arraysetctor(void* p, void* value, size_t count, TypeInfo ti) // void* _d_arraysetctor(void* p, void* value, int count, TypeInfo ti)
{ {
llvm::StringRef fname("_d_arraysetassign"); llvm::StringRef fname("_d_arraysetassign");
llvm::StringRef fname2("_d_arraysetctor"); llvm::StringRef fname2("_d_arraysetctor");