From: Eric Botcazou Date: Thu, 9 Jan 2003 09:33:04 +0000 (+0100) Subject: re PR c/8032 (GCC >= 3.0 incorrectly initializes static structs in the presence of... X-Git-Tag: releases/gcc-3.2.2~126 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a71385cddaddbc057a66d072089a2cd977ac953;p=thirdparty%2Fgcc.git re PR c/8032 (GCC >= 3.0 incorrectly initializes static structs in the presence of flexible arrays) PR c/8032 * c-typeck.c (process_init_element) [RECORD_TYPE]: For an empty element, do not advance the pointer to unfilled fields if there are pending initializers. From-SVN: r61096 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2c97554f75f2..3986de367df5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2003-01-09 Eric Botcazou + + PR c/8032 + * c-typeck.c (process_init_element) [RECORD_TYPE]: For + an empty element, do not advance the pointer to unfilled + fields if there are pending initializers. + 2003-01-07 Janis Johnson PR other/8947 diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 8093135ef6cf..fda2710acd49 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -6645,13 +6645,18 @@ process_init_element (value) bit_position (constructor_fields), DECL_SIZE (constructor_fields)); - constructor_unfilled_fields = TREE_CHAIN (constructor_fields); - /* Skip any nameless bit fields. */ - while (constructor_unfilled_fields != 0 - && DECL_C_BIT_FIELD (constructor_unfilled_fields) - && DECL_NAME (constructor_unfilled_fields) == 0) - constructor_unfilled_fields = - TREE_CHAIN (constructor_unfilled_fields); + /* If the current field was the first one not yet written out, + it isn't now, so update. */ + if (constructor_unfilled_fields == constructor_fields) + { + constructor_unfilled_fields = TREE_CHAIN (constructor_fields); + /* Skip any nameless bit fields. */ + while (constructor_unfilled_fields != 0 + && DECL_C_BIT_FIELD (constructor_unfilled_fields) + && DECL_NAME (constructor_unfilled_fields) == 0) + constructor_unfilled_fields = + TREE_CHAIN (constructor_unfilled_fields); + } } constructor_fields = TREE_CHAIN (constructor_fields); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cd5fa02cedbc..8eaec5b9e989 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2003-01-09 Eric Botcazou + + * gcc.c-torture/execute/20030109-1.c: New test. + 2002-12-26 Nathan Sidwell * g++.dg/template/qualttp20.C: Adjust expected errors.