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
This commit is contained in:
parent
6265d07ce0
commit
6f8f67e97d
4 changed files with 23 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
12
gcc/testsuite/gcc.dg/pr54363.c
Normal file
12
gcc/testsuite/gcc.dg/pr54363.c
Normal file
|
@ -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" } };
|
||||
}
|
Loading…
Add table
Reference in a new issue