]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/19435 (spurious warnings with nested array constructors)
authorJoseph Myers <joseph@codesourcery.com>
Wed, 2 Feb 2005 18:03:20 +0000 (18:03 +0000)
committerJoseph Myers <jsm28@gcc.gnu.org>
Wed, 2 Feb 2005 18:03:20 +0000 (18:03 +0000)
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

gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/c99-init-4.c [new file with mode: 0644]

index d1096267bbcaabd90970f318d1fcb293dee68170..9a7054c4ae339aedae816547523ccc06c59e4137 100644 (file)
@@ -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
index 54f9714f514a5fc2c3b5ea9391aae306fb08105e..f04ba73ad75fe5fa772bea03cc44eb8e423067e8 100644 (file)
@@ -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;
     }
index 636dd4fcc3cf54a14d4b8f815b1872390cb976c1..ea9c8904b0c94e62ed919ac4e27e48ca8220e3b7 100644 (file)
@@ -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 (file)
index 0000000..7073557
--- /dev/null
@@ -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 }) } };