Commit 06302a02 by Jakub Jelinek Committed by Jakub Jelinek

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
parent b57d8e6f
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> 2009-10-27 Richard Guenther <rguenther@suse.de>
* tree-complex.c (expand_complex_div_wide): Check for * tree-complex.c (expand_complex_div_wide): Check for
...@@ -2739,6 +2739,7 @@ convert_arguments (tree typelist, VEC(tree,gc) *values, ...@@ -2739,6 +2739,7 @@ convert_arguments (tree typelist, VEC(tree,gc) *values,
{ {
tree typetail, val; tree typetail, val;
unsigned int parmnum; unsigned int parmnum;
bool error_args = false;
const bool type_generic = fundecl const bool type_generic = fundecl
&& lookup_attribute ("type generic", TYPE_ATTRIBUTES(TREE_TYPE (fundecl))); && lookup_attribute ("type generic", TYPE_ATTRIBUTES(TREE_TYPE (fundecl)));
bool type_generic_remove_excess_precision = false; bool type_generic_remove_excess_precision = false;
...@@ -3008,6 +3009,8 @@ convert_arguments (tree typelist, VEC(tree,gc) *values, ...@@ -3008,6 +3009,8 @@ convert_arguments (tree typelist, VEC(tree,gc) *values,
parmval = default_conversion (val); parmval = default_conversion (val);
VEC_replace (tree, values, parmnum, parmval); VEC_replace (tree, values, parmnum, parmval);
if (parmval == error_mark_node)
error_args = true;
if (typetail) if (typetail)
typetail = TREE_CHAIN (typetail); typetail = TREE_CHAIN (typetail);
...@@ -3021,7 +3024,7 @@ convert_arguments (tree typelist, VEC(tree,gc) *values, ...@@ -3021,7 +3024,7 @@ convert_arguments (tree typelist, VEC(tree,gc) *values,
return -1; return -1;
} }
return parmnum; return error_args ? -1 : (int) parmnum;
} }
/* This is the entry point used by the parser to build unary operators /* This is the entry point used by the parser to build unary operators
......
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> 2009-10-27 Revital Eres <eres@il.ibm.com>
PR tree-optimization/40648 PR tree-optimization/40648
......
/* PR c/41842 */
/* { dg-do compile } */
void
f ()
{
char x[g (h)]; /* { dg-error "undeclared|for each function" } */
}
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