From 9929321af792cefeb26ff1e59287f94fc0112b2c Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Mon, 3 Nov 2014 12:35:35 +0000 Subject: [PATCH] re PR c/52769 (Unspecified designated initializer might not set to zero in some cases) PR c/52769 * gcc.dg/pr52769.c: New test. From-SVN: r217036 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr52769.c | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr52769.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 480e139387a..e9ffad43628 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-11-03 Marek Polacek + + PR c/52769 + * gcc.dg/pr52769.c: New test. + 2014-11-03 Paolo Carlini PR c++/57820 diff --git a/gcc/testsuite/gcc.dg/pr52769.c b/gcc/testsuite/gcc.dg/pr52769.c new file mode 100644 index 00000000000..138cecb14dc --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr52769.c @@ -0,0 +1,24 @@ +/* PR c/52769 */ +/* { dg-do run } */ +/* { dg-options "-O3" } */ + +typedef struct +{ + int should_be_zero; + char s[6]; + int x; +} foo_t; + +int +main (void) +{ + volatile foo_t foo = { + .s = "123456", + .x = 2 + }; + + if (foo.should_be_zero != 0) + __builtin_abort (); + + return 0; +} -- 2.30.2