diff options
author | mkuvyrkov <mkuvyrkov@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-05-06 10:28:46 +0000 |
---|---|---|
committer | mkuvyrkov <mkuvyrkov@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-05-06 10:28:46 +0000 |
commit | ea181df02d140bae7e14ba78713fd721ae3c17db (patch) | |
tree | 9319d57e69845176e990416338a7a051a090b809 /gcc/tree.c | |
parent | 1f3db819ff589fec50544ce334ae0200afade36f (diff) | |
download | gcc-ea181df02d140bae7e14ba78713fd721ae3c17db.tar.gz |
* tree.c (initializer_zerop): Handle STRING_CST.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159103 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index b9eeb3d9693..c45e807b43d 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -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; } |