aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/gimplify.c3
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/gcc.dg/pr54363.c12
4 files changed, 23 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a51eea2..f160b8f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2012-08-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/54363
+ * gimplify.c (optimize_compound_literals_in_ctor): Only recurse
+ if init is a CONSTRUCTOR.
+
2012-08-24 Steven Bosscher <steven@gcc.gnu.org>
* tree-ssa-live.c (dump_var_map): Do not dump the partition
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index ed2474f..2793027 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -3857,7 +3857,8 @@ optimize_compound_literals_in_ctor (tree orig_ctor)
if (!TREE_ADDRESSABLE (value)
&& !TREE_ADDRESSABLE (decl)
- && init)
+ && init
+ && TREE_CODE (init) == CONSTRUCTOR)
newval = optimize_compound_literals_in_ctor (init);
}
if (newval == value)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6fa0755..eeb62dc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2012-08-24 Jakub Jelinek <jakub@redhat.com>
+ PR c/54363
+ * gcc.dg/pr54363.c: New test.
+
PR c/54355
* gcc.dg/pr54355.c: New test.
diff --git a/gcc/testsuite/gcc.dg/pr54363.c b/gcc/testsuite/gcc.dg/pr54363.c
new file mode 100644
index 0000000..aea0f905
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr54363.c
@@ -0,0 +1,12 @@
+/* PR c/54363 */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+struct S { char **a; };
+
+void
+test (void)
+{
+ struct S b = { .a = (char **) { "a", "b" } }; /* { dg-warning "(initialization|excess elements)" } */
+ struct S c = { .a = (char *[]) { "a", "b" } };
+}