Skip to content

Commit

Permalink
fix Issue 14699 - ICE: segfaults on array with zero size
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Jun 15, 2015
1 parent 58b3055 commit 5d70b1a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/todt.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,10 +773,15 @@ dt_t **Type_toDt(Type *t, dt_t **pdt)

dt_t **toDtElem(TypeSArray *tsa, dt_t **pdt, Expression *e)
{
//printf("TypeSArray::toDtElem()\n");
size_t len = tsa->dim->toInteger();
if (len)
//printf("TypeSArray::toDtElem() tsa = %s\n", tsa->toChars());
if (tsa->size(Loc()) == 0)
{
pdt = dtnzeros(pdt, 0);
}
else
{
size_t len = tsa->dim->toInteger();
assert(len);
pdt = dtend(pdt);
Type *tnext = tsa->next;
Type *tbn = tnext->toBasetype();
Expand Down
14 changes: 14 additions & 0 deletions test/runnable/testdt.d
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ void test13505()
auto s = S13505();
}

/******************************************/
// 14699

struct S14699a { ubyte[0][10] values; }
struct S14699b { S14699a tbl; }
// +/

ubyte[0][1] sa14699;

void test14699()
{
//auto p = &sa14699; // Cannot work in Win32 (OMF)
}

/******************************************/

int main()
Expand Down

0 comments on commit 5d70b1a

Please sign in to comment.