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

PR c/17301
	* builtins.c (expand_builtin_va_start): Check for too few
	arguments to va_start.

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

From-SVN: r88835
This commit is contained in:
Joseph Myers 2004-10-10 02:10:53 +01:00 committed by Joseph Myers
parent 216a5f1b3f
commit c69c9b36a9
4 changed files with 27 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2004-10-10 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/17301
* builtins.c (expand_builtin_va_start): Check for too few
arguments to va_start.
2004-10-10 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/17189

View File

@ -3861,6 +3861,11 @@ expand_builtin_va_start (tree arglist)
chain = TREE_CHAIN (arglist);
if (!chain)
{
error ("too few arguments to function %<va_start%>");
return const0_rtx;
}
if (TREE_CHAIN (chain))
error ("too many arguments to function %<va_start%>");

View File

@ -1,3 +1,8 @@
2004-10-10 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/17301
* gcc.dg/pr17301-1.c: New test.
2004-10-10 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/17189

View File

@ -0,0 +1,11 @@
/* Invalid use of __builtin_stdarg_start should not cause an ICE. Bug
17301. */
/* { dg-do compile } */
/* { dg-options "" } */
int
write_format (char *format, ...)
{
__builtin_va_list p;
__builtin_stdarg_start (p); /* { dg-error "error: too few arguments to function 'va_start'" } */
}