Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

Commit

Permalink
Bug 127 - ICE on empty static array
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw committed May 31, 2014
1 parent 6a7a937 commit e51ad7c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions gcc/d/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2014-05-31 Iain Buclaw <ibuclaw@gdcproject.org>

* d-todt.cc(dt_container): Properly handle zero length static arrays.

2014-05-21 Iain Buclaw <ibuclaw@gdcproject.org>

* d-builtins.c(d_init_builtins): Use void_node instead of
Expand Down
14 changes: 10 additions & 4 deletions gcc/d/d-todt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,19 @@ dt_container (dt_t **pdt, Type *type, dt_t *dt)
tree value;
size_t i;

gcc_assert (CONSTRUCTOR_NELTS (dt) == tsa->dim->toInteger());
if (dt == NULL)
dt = dt_container2 (dt);
else
{
gcc_assert (CONSTRUCTOR_NELTS (dt) == tsa->dim->toInteger());

FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (dt), i, value)
CONSTRUCTOR_APPEND_ELT (elts, size_int (i), value);
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (dt), i, value)
CONSTRUCTOR_APPEND_ELT (elts, size_int (i), value);

CONSTRUCTOR_ELTS (dt) = elts;
}

TREE_TYPE (dt) = type->toCtype();
CONSTRUCTOR_ELTS (dt) = elts;
TREE_CONSTANT (dt) = 1;
TREE_READONLY (dt) = 1;
TREE_STATIC (dt) = 1;
Expand Down

0 comments on commit e51ad7c

Please sign in to comment.