OSDN Git Service

PR c/19435
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 2 Feb 2005 18:03:20 +0000 (18:03 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 2 Feb 2005 18:03:20 +0000 (18:03 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94595 138bc75d-0d04-0410-961f-82ee72b054a4

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

index d109626..9a7054c 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 54f9714..f04ba73 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 636dd4f..ea9c890 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 }) } };