2
0
mirror of git://gcc.gnu.org/git/gcc.git synced 2025-04-24 13:31:22 +08:00

re PR c/17301 (ICE on wrong usage of __builtin_stdarg_start)

PR c/17301
	* c-typeck.c (convert_arguments): Return error_mark_node if there
	are too few arguments.
	(build_function_call): Handle error_mark_node return from
	convert_arguments.

testsuite:
	* gcc.dg/pr17301-2.c: New test.

From-SVN: r88921
This commit is contained in:
Joseph Myers 2004-10-12 09:32:17 +01:00 committed by Joseph Myers
parent 35f06ae466
commit 3789b31650
4 changed files with 31 additions and 2 deletions

@ -1,3 +1,11 @@
2004-10-12 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/17301
* c-typeck.c (convert_arguments): Return error_mark_node if there
are too few arguments.
(build_function_call): Handle error_mark_node return from
convert_arguments.
2004-10-06 Paolo Bonzini <bonzini@gnu.org>
* configure.ac (symbolic_link): Replace with $LN_S.

@ -1987,6 +1987,9 @@ build_function_call (tree function, tree params)
coerced_params
= convert_arguments (TYPE_ARG_TYPES (fntype), params, function, fundecl);
if (coerced_params == error_mark_node)
return error_mark_node;
/* Check that the arguments to the function are valid. */
check_function_arguments (TYPE_ATTRIBUTES (fntype), coerced_params);
@ -2014,7 +2017,8 @@ build_function_call (tree function, tree params)
/* Convert the argument expressions in the list VALUES
to the types in the list TYPELIST. The result is a list of converted
argument expressions.
argument expressions, unless there are too few arguments in which
case it is error_mark_node.
If TYPELIST is exhausted, or when an element has NULL as its type,
perform the default conversions.
@ -2219,7 +2223,10 @@ convert_arguments (tree typelist, tree values, tree function, tree fundecl)
}
if (typetail != 0 && TREE_VALUE (typetail) != void_type_node)
error ("too few arguments to function %qE", function);
{
error ("too few arguments to function %qE", function);
return error_mark_node;
}
return nreverse (result);
}

@ -1,3 +1,8 @@
2004-10-12 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/17301
* gcc.dg/pr17301-2.c: New test.
2004-10-11 Mark Mitchell <mark@codesourcery.com>
PR c++/15876

@ -0,0 +1,9 @@
/* Invalid use of __builtin_stdarg_start should not cause an ICE. Bug
17301. Case with no arguments. */
/* { dg-do compile } */
/* { dg-options "" } */
void foo (char *format, ...)
{
__builtin_stdarg_start (); /* { dg-error "error: too few arguments to function '__builtin_stdarg_start'" } */
}