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