Commit da0fc454 by Marek Polacek Committed by Marek Polacek

re PR c/59351 (ICE on empty compound literal with -pedantic)

	PR c/59351
c/
	* c-decl.c (build_compound_literal): Allow compound literals with
	empty initial value.
testsuite/
	* gcc.dg/pr59351.c: New test.

From-SVN: r205627
parent 199f847c
2013-12-03 Marek Polacek <polacek@redhat.com>
PR c/59351
* c-decl.c (build_compound_literal): Allow compound literals with
empty initial value.
2013-12-02 Joseph Myers <joseph@codesourcery.com>
PR c/58235
......
......@@ -4693,7 +4693,9 @@ build_compound_literal (location_t loc, tree type, tree init, bool non_const)
{
int failure = complete_array_type (&TREE_TYPE (decl),
DECL_INITIAL (decl), true);
gcc_assert (!failure);
/* If complete_array_type returns 3, it means that the
initial value of the compound literal is empty. Allow it. */
gcc_assert (failure == 0 || failure == 3);
type = TREE_TYPE (decl);
TREE_TYPE (DECL_INITIAL (decl)) = type;
......
2013-12-03 Marek Polacek <polacek@redhat.com>
PR c/59351
* gcc.dg/pr59351.c: New test.
2013-12-03 Chung-Ju Wu <jasonwucj@gmail.com>
* gcc.dg/20020312-2.c: Add __nds32__ case.
......
/* { dg-do compile } */
/* { dg-options "-std=c99 -Wpedantic" } */
unsigned int
foo (void)
{
return sizeof ((int[]) {}); /* { dg-warning "ISO C forbids empty initializer braces" } */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment