diff options
author | Jakub Jelinek <jakub@redhat.com> | 2012-08-24 23:46:17 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2012-08-24 23:46:17 +0200 |
commit | 6f8f67e97de542d658c759ab1e55d8b7cfed4f58 (patch) | |
tree | 5e2df0986a315f00dbbcbcbdb12c31359df2f218 | |
parent | 6265d07ce0d8cdbfba7d3057804441d1a14f5b73 (diff) | |
download | gcc-6f8f67e97de542d658c759ab1e55d8b7cfed4f58.zip gcc-6f8f67e97de542d658c759ab1e55d8b7cfed4f58.tar.gz gcc-6f8f67e97de542d658c759ab1e55d8b7cfed4f58.tar.bz2 |
re PR c/54363 (ICE when compiling malformed struct initializers)
PR c/54363
* gimplify.c (optimize_compound_literals_in_ctor): Only recurse
if init is a CONSTRUCTOR.
* gcc.dg/pr54363.c: New test.
From-SVN: r190657
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/gimplify.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr54363.c | 12 |
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" } }; +} |