OSDN Git Service

PR c/52880
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Apr 2012 09:18:49 +0000 (09:18 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Apr 2012 09:18:49 +0000 (09:18 +0000)
* c-typeck.c (set_nonincremental_init,
set_nonincremental_init_from_string): Pass true instead of false
as IMPLICIT to add_pending_init.

* gcc.dg/pr52880.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@186809 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr52880.c [new file with mode: 0644]

index 0c230a3..37f23f8 100644 (file)
@@ -1,3 +1,10 @@
+2012-04-25  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/52880
+       * c-typeck.c (set_nonincremental_init,
+       set_nonincremental_init_from_string): Pass true instead of false
+       as IMPLICIT to add_pending_init.
+
 2012-04-24  Georg-Johann Lay  <avr@gjlay.de>
 
        Backport from 2012-04-24 mainline r186768.
index 1eacf03..fc01a79 100644 (file)
@@ -7598,7 +7598,7 @@ set_nonincremental_init (struct obstack * braced_init_obstack)
 
   FOR_EACH_CONSTRUCTOR_ELT (constructor_elements, ix, index, value)
     {
-      add_pending_init (index, value, NULL_TREE, false,
+      add_pending_init (index, value, NULL_TREE, true,
                        braced_init_obstack);
     }
   constructor_elements = 0;
@@ -7691,7 +7691,7 @@ set_nonincremental_init_from_string (tree str,
        }
 
       value = build_int_cst_wide (type, val[1], val[0]);
-      add_pending_init (purpose, value, NULL_TREE, false,
+      add_pending_init (purpose, value, NULL_TREE, true,
                         braced_init_obstack);
     }
 
index baee57b..94bbe27 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-25  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/52880
+       * gcc.dg/pr52880.c: New test.
+
 2012-04-24  Georg-Johann Lay  <avr@gjlay.de>
 
        PR testsuite/52641
diff --git a/gcc/testsuite/gcc.dg/pr52880.c b/gcc/testsuite/gcc.dg/pr52880.c
new file mode 100644 (file)
index 0000000..5a83de8
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR c/52880 */
+/* { dg-do compile } */
+/* { dg-options "-Woverride-init" } */
+
+struct A { int a; int b; };
+struct B { struct A c; int d, e; };
+struct B f = { .c.a = 0, .e = 1, .d = 2, .c.b = 3 };
+struct C { int g; int h; };
+struct D { int i; struct C j; int k; };
+struct D l = { .j.g = 0, .k = 1, .i = 2, .j.h = 3 };