]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/52769 (Unspecified designated initializer might not set to zero in some cases)
authorMarek Polacek <polacek@redhat.com>
Mon, 3 Nov 2014 12:39:42 +0000 (12:39 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 3 Nov 2014 12:39:42 +0000 (12:39 +0000)
PR c/52769
* gcc.dg/pr52769.c: New test.

From-SVN: r217038

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr52769.c [new file with mode: 0644]

index 65c98a7f1daaa3206b4643746668b91bd91db25f..3b05295c12bd99fee2303b547af9da9d849edb66 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-03  Marek Polacek  <polacek@redhat.com>
+
+       PR c/52769
+       * gcc.dg/pr52769.c: New test.
+
 2014-10-29  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * gcc.target/aarch64/madd_after_asm_1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/pr52769.c b/gcc/testsuite/gcc.dg/pr52769.c
new file mode 100644 (file)
index 0000000..138cecb
--- /dev/null
@@ -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;
+}