aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-01-18 21:30:33 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-01-18 21:30:33 +0100
commit6aee2fd0648140a7308123c1368e772cf58738ff (patch)
treed3b25d4d5a26001425b9b68638df47855a0c1354 /gcc/gimplify.c
parentd3a9902e523f81f07e765b2553dde7019aa098fb (diff)
downloadgcc-6aee2fd0648140a7308123c1368e772cf58738ff.zip
gcc-6aee2fd0648140a7308123c1368e772cf58738ff.tar.gz
gcc-6aee2fd0648140a7308123c1368e772cf58738ff.tar.bz2
re PR sanitizer/81715 (asan-stack=1 redzone allocation is too inflexible)
PR sanitizer/81715 PR testsuite/83882 * function.h (gimplify_parameters): Add gimple_seq * argument. * function.c: Include gimple.h and options.h. (gimplify_parameters): Add cleanup argument, add CLOBBER stmts for the added local temporaries if needed. * gimplify.c (gimplify_body): Adjust gimplify_parameters caller, if there are any parameter cleanups, wrap whole body into a try/finally with the cleanups. From-SVN: r256861
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 8e86c338..7fedd97 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -12589,7 +12589,7 @@ gbind *
gimplify_body (tree fndecl, bool do_parms)
{
location_t saved_location = input_location;
- gimple_seq parm_stmts, seq;
+ gimple_seq parm_stmts, parm_cleanup = NULL, seq;
gimple *outer_stmt;
gbind *outer_bind;
struct cgraph_node *cgn;
@@ -12628,7 +12628,7 @@ gimplify_body (tree fndecl, bool do_parms)
/* Resolve callee-copies. This has to be done before processing
the body so that DECL_VALUE_EXPR gets processed correctly. */
- parm_stmts = do_parms ? gimplify_parameters () : NULL;
+ parm_stmts = do_parms ? gimplify_parameters (&parm_cleanup) : NULL;
/* Gimplify the function's body. */
seq = NULL;
@@ -12657,6 +12657,13 @@ gimplify_body (tree fndecl, bool do_parms)
tree parm;
gimplify_seq_add_seq (&parm_stmts, gimple_bind_body (outer_bind));
+ if (parm_cleanup)
+ {
+ gtry *g = gimple_build_try (parm_stmts, parm_cleanup,
+ GIMPLE_TRY_FINALLY);
+ parm_stmts = NULL;
+ gimple_seq_add_stmt (&parm_stmts, g);
+ }
gimple_bind_set_body (outer_bind, parm_stmts);
for (parm = DECL_ARGUMENTS (current_function_decl);