Blame SOURCES/gcc48-pr60784.patch

56d343
2014-05-02  Marek Polacek  <polacek@redhat.com>
56d343
56d343
	PR c/60784
56d343
	* c-typeck.c (push_init_level): Set constructor_designated to
56d343
	p->designated for structures.
56d343
56d343
--- gcc/c/c-typeck.c
56d343
+++ gcc/c/c-typeck.c
56d343
@@ -7270,6 +7270,9 @@ push_init_level (int implicit, struct obstack * braced_init_obstack)
56d343
 	  push_member_name (constructor_fields);
56d343
 	  constructor_depth++;
56d343
 	}
56d343
+      /* If upper initializer is designated, then mark this as
56d343
+	 designated too to prevent bogus warnings.  */
56d343
+      constructor_designated = p->designated;
56d343
     }
56d343
   else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
56d343
     {
56d343
--- /dev/null
56d343
+++ gcc/testsuite/gcc.dg/pr60784.c
56d343
@@ -0,0 +1,25 @@
56d343
+/* PR c/60784 */
56d343
+/* { dg-do compile } */
56d343
+/* { dg-options "-Wextra -std=c99" } */
56d343
+
56d343
+struct A { int i, j; };
56d343
+struct B { struct A a; } b1 = { .a.i = 1, .a.j = 1 };
56d343
+struct B b2 = { .a.i = 1 };
56d343
+
56d343
+struct C { struct { int a, b; }; } c1 = { .a = 4, .b = 2 };
56d343
+struct C c2 = { .a = 4, .b = 2 };
56d343
+
56d343
+struct D { struct A a; };
56d343
+struct E { struct D d; };
56d343
+struct F { struct E e; } f1 = { .e.d.a.i = 8 };
56d343
+struct F f2 = { .e.d.a.i = 8, .e.d.a.j = 3 };
56d343
+
56d343
+struct G {
56d343
+  struct {
56d343
+    struct {
56d343
+      struct {
56d343
+        int a, b, c, d, e, f;
56d343
+      };
56d343
+    };
56d343
+  };
56d343
+} g = { .b = 2 };