aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.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/function.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/function.c')
-rw-r--r--gcc/function.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/function.c b/gcc/function.c
index d1d2edb..1a09ff0 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -79,6 +79,8 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa.h"
#include "stringpool.h"
#include "attribs.h"
+#include "gimple.h"
+#include "options.h"
/* So we can assign to cfun in this file. */
#undef cfun
@@ -3993,7 +3995,7 @@ gimplify_parm_type (tree *tp, int *walk_subtrees, void *data)
statements to add to the beginning of the function. */
gimple_seq
-gimplify_parameters (void)
+gimplify_parameters (gimple_seq *cleanup)
{
struct assign_parm_data_all all;
tree parm;
@@ -4058,6 +4060,16 @@ gimplify_parameters (void)
else if (TREE_CODE (type) == COMPLEX_TYPE
|| TREE_CODE (type) == VECTOR_TYPE)
DECL_GIMPLE_REG_P (local) = 1;
+
+ if (!is_gimple_reg (local)
+ && flag_stack_reuse != SR_NONE)
+ {
+ tree clobber = build_constructor (type, NULL);
+ gimple *clobber_stmt;
+ TREE_THIS_VOLATILE (clobber) = 1;
+ clobber_stmt = gimple_build_assign (local, clobber);
+ gimple_seq_add_stmt (cleanup, clobber_stmt);
+ }
}
else
{