aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-10-31 08:10:57 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-10-31 08:10:57 +0100
commitfbdbe8b06a1c5626ad6360a4af33cb638c14cda1 (patch)
tree6f3b3270e66eb2e75172648e9848a118150d9d5e /gcc/cp/decl.c
parente4c431266f9aaf604edfca68e852ae8efe966e8e (diff)
downloadgcc-fbdbe8b06a1c5626ad6360a4af33cb638c14cda1.zip
gcc-fbdbe8b06a1c5626ad6360a4af33cb638c14cda1.tar.gz
gcc-fbdbe8b06a1c5626ad6360a4af33cb638c14cda1.tar.bz2
re PR c++/90947 (Simple lookup table of array of strings is miscompiled)
PR c++/90947 * tree.h (type_initializer_zero_p): Remove. * tree.c (type_initializer_zero_p): Remove. cp/ * cp-tree.h (type_initializer_zero_p): Declare. * decl.c (reshape_init_array_1): Formatting fix. * tree.c (type_initializer_zero_p): New function. Moved from ../tree.c, use next_initializable_field, formatting fix. Return false for TYPE_NON_AGGREGATE_CLASS types. From-SVN: r277656
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 8320597..72acc8f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5973,9 +5973,8 @@ reshape_init_array_1 (tree elt_type, tree max_index, reshape_iter *d,
/* Pointers initialized to strings must be treated as non-zero
even if the string is empty. */
tree init_type = TREE_TYPE (elt_init);
- if ((POINTER_TYPE_P (elt_type) != POINTER_TYPE_P (init_type)))
- last_nonzero = index;
- else if (!type_initializer_zero_p (elt_type, elt_init))
+ if (POINTER_TYPE_P (elt_type) != POINTER_TYPE_P (init_type)
+ || !type_initializer_zero_p (elt_type, elt_init))
last_nonzero = index;
/* This can happen with an invalid initializer (c++/54501). */