diff options
author | Andrew Pinski <pinskia@gcc.gnu.org> | 2004-12-04 06:11:45 -0800 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2004-12-04 06:11:45 -0800 |
commit | 2efcfa4ef6cd96146871e8c7f4de5ed76a9fefab (patch) | |
tree | cbf7c78afc4e2cbb6aeed7f265db741b9c045876 /gcc/gimplify.c | |
parent | e4887861341b842247647d2a5e2e45b45c358895 (diff) | |
download | gcc-2efcfa4ef6cd96146871e8c7f4de5ed76a9fefab.zip gcc-2efcfa4ef6cd96146871e8c7f4de5ed76a9fefab.tar.gz gcc-2efcfa4ef6cd96146871e8c7f4de5ed76a9fefab.tar.bz2 |
re PR middle-end/17909 (ICE: verifiy_stms failed)
2004-12-04 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/17909
* builtins.c (fold_builtin_next_arg): Export and return true
when there is a warning or an error.
(expand_builtin_va_start): When fold_builtin_next_arg returns true,
return const0_rtx.
(expand_builtin): Likewise.
* gimplify.c (gimplify_call_expr): Error out if there is not
enough arguments to va_start. Call fold_builtin_next_arg also
on the second argument.
* tree.h (fold_builtin_next_arg): Prototype.
From-SVN: r91727
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 6ee49b6..6a9e3b1 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1744,9 +1744,25 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value) } if (DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_START) - /* Avoid gimplifying the second argument to va_start, which needs - to be the plain PARM_DECL. */ - return gimplify_arg (&TREE_VALUE (TREE_OPERAND (*expr_p, 1)), pre_p); + { + tree arglist = TREE_OPERAND (*expr_p, 1); + + if (!arglist || !TREE_CHAIN (arglist)) + { + error ("too few arguments to function %<va_start%>"); + *expr_p = build_empty_stmt (); + return GS_OK; + } + + if (fold_builtin_next_arg (TREE_CHAIN (arglist))) + { + *expr_p = build_empty_stmt (); + return GS_OK; + } + /* Avoid gimplifying the second argument to va_start, which needs + to be the plain PARM_DECL. */ + return gimplify_arg (&TREE_VALUE (TREE_OPERAND (*expr_p, 1)), pre_p); + } } /* There is a sequence point before the call, so any side effects in |