+2018-01-18 Jakub Jelinek <jakub@redhat.com>
+
+ 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.
+
2018-01-18 Wilco Dijkstra <wdijkstr@arm.com>
PR target/82964
#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
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;
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
{
extern void instantiate_decl_rtl (rtx x);
extern int aggregate_value_p (const_tree, const_tree);
extern bool use_register_for_decl (const_tree);
-extern gimple_seq gimplify_parameters (void);
+extern gimple_seq gimplify_parameters (gimple_seq *);
extern void locate_and_pad_parm (machine_mode, tree, int, int, int,
tree, struct args_size *,
struct locate_and_pad_arg_data *);
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;
/* 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;
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);