Commit 3789b316 by Joseph Myers Committed by Joseph Myers

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
parent 35f06ae4
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> 2004-10-06 Paolo Bonzini <bonzini@gnu.org>
* configure.ac (symbolic_link): Replace with $LN_S. * configure.ac (symbolic_link): Replace with $LN_S.
......
...@@ -1987,6 +1987,9 @@ build_function_call (tree function, tree params) ...@@ -1987,6 +1987,9 @@ build_function_call (tree function, tree params)
coerced_params coerced_params
= convert_arguments (TYPE_ARG_TYPES (fntype), params, function, fundecl); = 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 that the arguments to the function are valid. */
check_function_arguments (TYPE_ATTRIBUTES (fntype), coerced_params); check_function_arguments (TYPE_ATTRIBUTES (fntype), coerced_params);
...@@ -2014,7 +2017,8 @@ build_function_call (tree function, tree params) ...@@ -2014,7 +2017,8 @@ build_function_call (tree function, tree params)
/* Convert the argument expressions in the list VALUES /* Convert the argument expressions in the list VALUES
to the types in the list TYPELIST. The result is a list of converted 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, If TYPELIST is exhausted, or when an element has NULL as its type,
perform the default conversions. perform the default conversions.
...@@ -2219,7 +2223,10 @@ convert_arguments (tree typelist, tree values, tree function, tree fundecl) ...@@ -2219,7 +2223,10 @@ convert_arguments (tree typelist, tree values, tree function, tree fundecl)
} }
if (typetail != 0 && TREE_VALUE (typetail) != void_type_node) 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); return nreverse (result);
} }
......
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> 2004-10-11 Mark Mitchell <mark@codesourcery.com>
PR c++/15876 PR c++/15876
......
/* 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'" } */
}
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