aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2005-02-02 18:03:20 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2005-02-02 18:03:20 +0000
commit493179dae3e45a9b25767c46c61f04ca3f9a3a17 (patch)
tree7ccd1aca680b7efb33ec9badfa5bf24703bbed11 /gcc
parentc7273283dffbb501858dbfbecd42d5515c49ad8e (diff)
downloadgcc-493179dae3e45a9b25767c46c61f04ca3f9a3a17.zip
gcc-493179dae3e45a9b25767c46c61f04ca3f9a3a17.tar.gz
gcc-493179dae3e45a9b25767c46c61f04ca3f9a3a17.tar.bz2
re PR c/19435 (spurious warnings with nested array constructors)
PR c/19435 * c-typeck.c (really_start_incremental_init): Reset constructor_max_index for arrays of incomplete type. testsuite: * gcc.dg/c99-init-4.c: New test. From-SVN: r94595
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-typeck.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/c99-init-4.c8
4 files changed, 23 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d109626..9a7054c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2005-02-02 Joseph S. Myers <joseph@codesourcery.com>
+
+ PR c/19435
+ * c-typeck.c (really_start_incremental_init): Reset
+ constructor_max_index for arrays of incomplete type.
+
2005-02-02 Jeff Law <law@redhat.com>
* gcse.c (struct reg_set): Store the block index where the register
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 54f9714..f04ba73 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -4674,7 +4674,10 @@ really_start_incremental_init (tree type)
TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type)));
}
else
- constructor_index = bitsize_zero_node;
+ {
+ constructor_index = bitsize_zero_node;
+ constructor_max_index = NULL_TREE;
+ }
constructor_unfilled_index = constructor_index;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 636dd4f..ea9c890 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-02-02 Joseph S. Myers <joseph@codesourcery.com>
+
+ PR c/19435
+ * gcc.dg/c99-init-4.c: New test.
+
2005-02-01 Janis Johnson <janis187@us.ibm.com>
* g++.old-deja/g++.other/init5.C: Remove xfail for powerpc-linux.
diff --git a/gcc/testsuite/gcc.dg/c99-init-4.c b/gcc/testsuite/gcc.dg/c99-init-4.c
new file mode 100644
index 0000000..7073557
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c99-init-4.c
@@ -0,0 +1,8 @@
+/* Test for nested initialization of a compound literal: must not be
+ checked against outer array bounds. Bug 19435. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
+
+struct s { char *p; };
+struct s a[1] = { { .p = ((char []){ 1, 2 }) } };