summaryrefslogtreecommitdiffstats
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-04 14:11:45 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-04 14:11:45 +0000
commit743b0c6afc7593e469c1350e4d6ac62753275188 (patch)
treecbf7c78afc4e2cbb6aeed7f265db741b9c045876 /gcc/gimplify.c
parenta9b22d67e41dbf12d64eea7f33455a2da23cc43e (diff)
downloadppe42-gcc-743b0c6afc7593e469c1350e4d6ac62753275188.tar.gz
ppe42-gcc-743b0c6afc7593e469c1350e4d6ac62753275188.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91727 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 6ee49b67f31..6a9e3b140c7 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
OpenPOWER on IntegriCloud