]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/8032 (GCC >= 3.0 incorrectly initializes static structs in the presence of...
authorEric Botcazou <ebotcazou@libertysurf.fr>
Thu, 9 Jan 2003 09:33:04 +0000 (10:33 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Thu, 9 Jan 2003 09:33:04 +0000 (09:33 +0000)
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

gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/ChangeLog

index 2c97554f75f2239712f14e8e6325fe5a3c7ff0d4..3986de367df569e28300f5fe3ba4fbe7f76f8481 100644 (file)
@@ -1,3 +1,10 @@
+2003-01-09  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       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  <janis187@us.ibm.com>
 
        PR other/8947
index 8093135ef6cfa98fa0d32d7e8e1a19f22cd726ff..fda2710acd4903e1f506d3744166d0bea81dcf8f 100644 (file)
@@ -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);
index cd5fa02cedbc527fa69d7dde46c441ff2fdbb81a..8eaec5b9e98942a652afd01248244f0ed1f235c6 100644 (file)
@@ -1,3 +1,7 @@
+2003-01-09  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * gcc.c-torture/execute/20030109-1.c: New test.
+
 2002-12-26  Nathan Sidwell  <nathan@codesourcery.com>
 
        * g++.dg/template/qualttp20.C: Adjust expected errors.