* tree.c (initializer_zerop): Handle STRING_CST.

From-SVN: r159103
This commit is contained in:
Maxim Kuvyrkov 2010-05-06 10:28:46 +00:00 committed by Maxim Kuvyrkov
parent 3734d9607e
commit 315a02daf1
2 changed files with 17 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2010-05-06 Maxim Kuvyrkov <maxim@codesourcery.com>
* tree.c (initializer_zerop): Handle STRING_CST.
2010-05-06 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 40989

View file

@ -9414,6 +9414,19 @@ initializer_zerop (const_tree init)
return true;
}
case STRING_CST:
{
int i;
/* We need to loop through all elements to handle cases like
"\0" and "\0foobar". */
for (i = 0; i < TREE_STRING_LENGTH (init); ++i)
if (TREE_STRING_POINTER (init)[i] != '\0')
return false;
return true;
}
default:
return false;
}