* varasm.c (array_size_for_constructor): Handle STRING_CSTs also.

From-SVN: r45785
This commit is contained in:
DJ Delorie 2001-09-24 16:27:06 -04:00 committed by DJ Delorie
parent 1b47b7aebb
commit b6fc711089
2 changed files with 11 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2001-09-24 DJ Delorie <dj@redhat.com>
* varasm.c (array_size_for_constructor): Handle STRING_CSTs also.
2001-09-24 Ulrich Weigand <uweigand@de.ibm.com>:
* flow.c (delete_dead_jumptables): Delete jumptable if the only

View File

@ -4585,6 +4585,13 @@ array_size_for_constructor (val)
{
tree max_index, i;
if (TREE_CODE (val) == STRING_CST)
{
HOST_WIDE_INT len = TREE_STRING_LENGTH(val);
HOST_WIDE_INT esz = int_size_in_bytes (TREE_TYPE (TREE_TYPE (val)));
HOST_WIDE_INT tsz = len * esz;
return tsz;
}
max_index = NULL_TREE;
for (i = CONSTRUCTOR_ELTS (val); i ; i = TREE_CHAIN (i))
{