aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2009-02-19 13:56:00 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2009-02-19 13:56:00 +0000
commitab4194daa89047e2eacb66ef8d5d702418905bb0 (patch)
tree4cadcaa3b993c651af0668a488634c85a19a1b6e /gcc/builtins.c
parent6b67572ed1a6f2fc43d07eead15e9eda973d339d (diff)
downloadgcc-ab4194daa89047e2eacb66ef8d5d702418905bb0.zip
gcc-ab4194daa89047e2eacb66ef8d5d702418905bb0.tar.gz
gcc-ab4194daa89047e2eacb66ef8d5d702418905bb0.tar.bz2
re PR c/38483 (generated aborts lose previous side-effects)
PR c/38483 * builtins.c (gimplify_va_arg_expr): Evaluate the va_list expression before any __builtin_trap call. * c-typeck.c (build_function_call): Convert and check function arguments before generating a call to a trap. Evaluate the function arguments before the trap. testsuite: * gcc.c-torture/execute/call-trap-1.c, gcc.c-torture/execute/va-arg-trap-1.c, gcc.dg/call-diag-1.c: New tests. From-SVN: r144296
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 57cce08..55639cd 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -4999,6 +4999,9 @@ gimplify_va_arg_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
Call abort to encourage the user to fix the program. */
if (warned)
inform (input_location, "if this code is reached, the program will abort");
+ /* Before the abort, allow the evaluation of the va_list
+ expression to exit or longjmp. */
+ gimplify_and_add (valist, pre_p);
t = build_call_expr (implicit_built_in_decls[BUILT_IN_TRAP], 0);
gimplify_and_add (t, pre_p);