This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for bug 19435


Bug 19435 isn't a regression, but it's a straightforward bug to fix.
Fixed thus.  Bootstrapped with no regressions on
x86_64-unknown-linux-gnu.  Applied to mainline.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)

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.

testsuite:
2005-02-02  Joseph S. Myers  <joseph@codesourcery.com>

	PR c/19435
	* gcc.dg/c99-init-4.c: New test.

diff -rupN GCC.orig/gcc/c-typeck.c GCC/gcc/c-typeck.c
--- GCC.orig/gcc/c-typeck.c	2005-02-01 21:27:12.000000000 +0000
+++ GCC/gcc/c-typeck.c	2005-02-01 21:38:23.000000000 +0000
@@ -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 -rupN GCC.orig/gcc/testsuite/gcc.dg/c99-init-4.c GCC/gcc/testsuite/gcc.dg/c99-init-4.c
--- GCC.orig/gcc/testsuite/gcc.dg/c99-init-4.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/c99-init-4.c	2005-02-01 21:36:05.000000000 +0000
@@ -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 }) } };


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]