Commit 822baa84 by Jakub Jelinek Committed by Jakub Jelinek

c-typeck.c (output_init_element): Call digest_init just once...

	* c-typeck.c (output_init_element): Call digest_init
	just once, not in each if branch and check its return value for
	error_mark_node.

	* gcc.dg/noncompile/20011025-1.c: New test.

From-SVN: r47673
parent a3315b53
2001-12-05 Jakub Jelinek <jakub@redhat.com>
* c-typeck.c (output_init_element): Call digest_init
just once, not in each if branch and check its return value for
error_mark_node.
2001-12-05 Jakub Jelinek <jakub@redhat.com>
* c-decl.c (pushdecl): Only increase n_incomplete if pushed decl's
type is RECORD_TYPE, UNION_TYPE or ARRAY_TYPE thereof.
(finish_struct): Break the loop if n_incomplete went to 0.
......
......@@ -6267,6 +6267,8 @@ output_init_element (value, type, field, pending)
|| TREE_CHAIN (field)))))
return;
value = digest_init (type, value, require_constant_value,
require_constant_elements);
if (value == error_mark_node)
{
constructor_erroneous = 1;
......@@ -6283,9 +6285,7 @@ output_init_element (value, type, field, pending)
&& tree_int_cst_lt (field, constructor_unfilled_index))
set_nonincremental_init ();
add_pending_init (field,
digest_init (type, value, require_constant_value,
require_constant_elements));
add_pending_init (field, value);
return;
}
else if (TREE_CODE (constructor_type) == RECORD_TYPE
......@@ -6311,9 +6311,7 @@ output_init_element (value, type, field, pending)
}
}
add_pending_init (field,
digest_init (type, value, require_constant_value,
require_constant_elements));
add_pending_init (field, value);
return;
}
else if (TREE_CODE (constructor_type) == UNION_TYPE
......@@ -6332,10 +6330,7 @@ output_init_element (value, type, field, pending)
if (field && TREE_CODE (field) == INTEGER_CST)
field = copy_node (field);
constructor_elements
= tree_cons (field, digest_init (type, value,
require_constant_value,
require_constant_elements),
constructor_elements);
= tree_cons (field, value, constructor_elements);
/* Advance the variable that indicates sequential elements output. */
if (TREE_CODE (constructor_type) == ARRAY_TYPE)
......
......@@ -2,6 +2,8 @@
* gcc.c-torture/compile/20011130-1.c: New test.
* gcc.dg/noncompile/20011025-1.c: New test.
2001-12-04 Joseph S. Myers <jsm28@cam.ac.uk>
* gcc.c-torture/execute/20000722-1.x,
......
double foo [] =
{ &bar, /* { dg-error "undeclared|is not constant|near init" } */
(void *) 0 }; /* { dg-error "incompatible types|is not constant|near init" } */
double baz [] =
{ (void *) 0 }; /* { dg-error "incompatible types|is not constant|near init" } */
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