re PR c/9799 (mismatching structure initializer with nested flexible array member, segfaults)

PR c/9799
	* c-typeck.c (push_init_level): Add sanity check.

From-SVN: r63831
This commit is contained in:
Eric Botcazou
2003-03-05 09:37:57 +01:00
committed by Eric Botcazou
parent 8234c6c11a
commit be2fa21183
4 changed files with 28 additions and 0 deletions
+5
View File
@@ -1,3 +1,8 @@
2003-03-05 Eric Botcazou <ebotcazou@libertysurf.fr>
PR c/9799
* c-typeck.c (push_init_level): Add sanity check.
Wed Mar 5 02:04:04 CET 2003 Jan Hubicka <jh@suse.cz>
* toplev.c (rest_of_compilation): Deffer RTL compilation only when
+1
View File
@@ -5273,6 +5273,7 @@ push_init_level (implicit)
&& constructor_fields == 0)
process_init_element (pop_init_level (1));
else if (TREE_CODE (constructor_type) == ARRAY_TYPE
&& constructor_max_index
&& tree_int_cst_lt (constructor_max_index, constructor_index))
process_init_element (pop_init_level (1));
else
+4
View File
@@ -1,3 +1,7 @@
2003-03-05 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.c-torture/compile/20030305-1.c
Wed Mar 5 02:05:19 CET 2003 Jan Hubicka <jh@suse.cz>
* gcc.dg/i386-local.c: New.
@@ -0,0 +1,18 @@
/* PR c/9799 */
/* Verify that GCC doesn't crash on excess elements
in initializer for a flexible array member. */
typedef struct {
int aaa;
} s1_t;
typedef struct {
int bbb;
s1_t s1_array[];
} s2_t;
static s2_t s2_array[]= {
{ 1, 4 },
{ 2, 5 },
{ 3, 6 }
};