Commit 05008a0c by Jakub Jelinek Committed by Jakub Jelinek

re PR c/35440 (ICE resulting in completely broken diagnostic)

	PR c/35440
	* c-pretty-print.c (pp_c_initializer_list): Handle CONSTRUCTOR
	for all types.

	* gcc.dg/pr35440.c: New test.

From-SVN: r133897
parent 5f4bebbf
2008-04-04 Jakub Jelinek <jakub@redhat.com>
PR c/35440
* c-pretty-print.c (pp_c_initializer_list): Handle CONSTRUCTOR
for all types.
2008-04-04 Richard Guenther <rguenther@suse.de>
PR middle-end/35823
......
......@@ -1173,6 +1173,12 @@ pp_c_initializer_list (c_pretty_printer *pp, tree e)
tree type = TREE_TYPE (e);
const enum tree_code code = TREE_CODE (type);
if (TREE_CODE (e) == CONSTRUCTOR)
{
pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e));
return;
}
switch (code)
{
case RECORD_TYPE:
......@@ -1207,16 +1213,12 @@ pp_c_initializer_list (c_pretty_printer *pp, tree e)
case VECTOR_TYPE:
if (TREE_CODE (e) == VECTOR_CST)
pp_c_expression_list (pp, TREE_VECTOR_CST_ELTS (e));
else if (TREE_CODE (e) == CONSTRUCTOR)
pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e));
else
break;
return;
case COMPLEX_TYPE:
if (TREE_CODE (e) == CONSTRUCTOR)
pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e));
else if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR)
if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR)
{
const bool cst = TREE_CODE (e) == COMPLEX_CST;
pp_expression (pp, cst ? TREE_REALPART (e) : TREE_OPERAND (e, 0));
......
2008-04-04 Jakub Jelinek <jakub@redhat.com>
PR c/35440
* gcc.dg/pr35440.c: New test.
2008-04-04 Richard Guenther <rguenther@suse.de>
PR middle-end/35823
/* PR c/35440 */
/* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
struct A {};
struct B { int i; char j[2]; };
void foo (void)
{
(struct A){}(); /* { dg-error "called object" } */
(struct B){ .i = 2, .j[1] = 1 }(); /* { dg-error "called object" } */
}
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