PR c/58346
* gimple-fold.c (fold_array_ctor_reference): Don't fold if element
size is zero.
testsuite/
* gcc.dg/pr58346.c: New test.
From-SVN: r206715
+2014-01-17 Marek Polacek <polacek@redhat.com>
+
+ PR c/58346
+ * gimple-fold.c (fold_array_ctor_reference): Don't fold if element
+ size is zero.
+
2014-01-17 Richard Biener <rguenther@suse.de>
PR tree-optimization/46590
be larger than size of array element. */
if (!TYPE_SIZE_UNIT (type)
|| TREE_CODE (TYPE_SIZE_UNIT (type)) != INTEGER_CST
- || elt_size.slt (tree_to_double_int (TYPE_SIZE_UNIT (type))))
+ || elt_size.slt (tree_to_double_int (TYPE_SIZE_UNIT (type)))
+ || elt_size.is_zero ())
return NULL_TREE;
/* Compute the array index we look for. */
+2014-01-17 Marek Polacek <polacek@redhat.com>
+
+ PR c/58346
+ * gcc.dg/pr58346.c: New test.
+
2014-01-17 Jakub Jelinek <jakub@redhat.com>
PR testsuite/58776
--- /dev/null
+/* PR tree-optimization/58346 */
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+struct U {};
+static struct U b[1] = { };
+extern void bar (struct U);
+
+void
+foo (void)
+{
+ bar (b[0]);
+}
+
+void
+baz (void)
+{
+ foo ();
+}