Mercurial > projects > ldc
changeset 1495:0c8d6d345001
The llvm element type of void arrays should be i8 and not void.
This caused DtoArrayCopyToSlice to fail when trying to get the size of
llvm-void for something like void[3] s = "abc"; inside a function.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Fri, 12 Jun 2009 20:39:01 +0200 |
parents | b243e28f63d4 |
children | b4fc62f047cd |
files | gen/arrays.cpp |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/arrays.cpp Fri Jun 12 16:41:38 2009 +0200 +++ b/gen/arrays.cpp Fri Jun 12 20:39:01 2009 +0200 @@ -184,7 +184,7 @@ assert(arrayelemty == valuety && "ArrayInit doesn't work on elem-initialized static arrays"); args[0] = DtoBitCast(args[0], getVoidPtrType()); args[2] = DtoBitCast(args[2], getVoidPtrType()); - args.push_back(DtoConstSize_t(getTypePaddedSize(DtoType(arrayelemty)))); + args.push_back(DtoConstSize_t(getTypePaddedSize(DtoTypeNotVoid(arrayelemty)))); break; default: @@ -247,7 +247,7 @@ // get elem type Type* elemty = arrty->nextOf(); - const LLType* llelemty = DtoType(elemty); + const LLType* llelemty = DtoTypeNotVoid(elemty); // true if array elements differ in type, can happen with array of unions bool mismatch = false; @@ -367,7 +367,7 @@ LLValue* dstarr = get_slice_ptr(dst,sz1); LLValue* srcarr = DtoBitCast(DtoArrayPtr(src), getVoidPtrType()); - const LLType* arrayelemty = DtoType(src->getType()->nextOf()->toBasetype()); + const LLType* arrayelemty = DtoTypeNotVoid(src->getType()->nextOf()->toBasetype()); LLValue* sz2 = gIR->ir->CreateMul(DtoConstSize_t(getTypePaddedSize(arrayelemty)), DtoArrayLen(src), "tmp"); if (global.params.useAssert || global.params.useArrayBounds)