re PR c/41842 (ICE on invalid variable length array declaration)

PR c/41842
	* c-typeck.c (convert_arguments): Return -1 if any of the arguments is
	error_mark_node.

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

From-SVN: r153599
This commit is contained in:
Jakub Jelinek 2009-10-27 16:50:50 +01:00 committed by Jakub Jelinek
parent b57d8e6f0c
commit 06302a02c0
4 changed files with 23 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2009-10-27 Jakub Jelinek <jakub@redhat.com>
PR c/41842
* c-typeck.c (convert_arguments): Return -1 if any of the arguments is
error_mark_node.
2009-10-27 Richard Guenther <rguenther@suse.de>
* tree-complex.c (expand_complex_div_wide): Check for

View File

@ -2739,6 +2739,7 @@ convert_arguments (tree typelist, VEC(tree,gc) *values,
{
tree typetail, val;
unsigned int parmnum;
bool error_args = false;
const bool type_generic = fundecl
&& lookup_attribute ("type generic", TYPE_ATTRIBUTES(TREE_TYPE (fundecl)));
bool type_generic_remove_excess_precision = false;
@ -3008,6 +3009,8 @@ convert_arguments (tree typelist, VEC(tree,gc) *values,
parmval = default_conversion (val);
VEC_replace (tree, values, parmnum, parmval);
if (parmval == error_mark_node)
error_args = true;
if (typetail)
typetail = TREE_CHAIN (typetail);
@ -3021,7 +3024,7 @@ convert_arguments (tree typelist, VEC(tree,gc) *values,
return -1;
}
return parmnum;
return error_args ? -1 : (int) parmnum;
}
/* This is the entry point used by the parser to build unary operators

View File

@ -1,3 +1,8 @@
2009-10-27 Jakub Jelinek <jakub@redhat.com>
PR c/41842
* gcc.dg/pr41842.c: New test.
2009-10-27 Revital Eres <eres@il.ibm.com>
PR tree-optimization/40648

View File

@ -0,0 +1,8 @@
/* PR c/41842 */
/* { dg-do compile } */
void
f ()
{
char x[g (h)]; /* { dg-error "undeclared|for each function" } */
}