aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-04-15 17:17:29 -0400
committerJason Merrill <jason@gcc.gnu.org>2015-04-15 17:17:29 -0400
commit58cc255ca031b2e0f5da7646347021248cc48805 (patch)
tree7ece978236340d6784aa4b3997ddc119b2cb5fd1 /gcc/cp/decl.c
parentefb5e8170a77bb24bab9eb6f3331d815e255c8ee (diff)
downloadgcc-58cc255ca031b2e0f5da7646347021248cc48805.zip
gcc-58cc255ca031b2e0f5da7646347021248cc48805.tar.gz
gcc-58cc255ca031b2e0f5da7646347021248cc48805.tar.bz2
constexpr.c (cxx_eval_store_expression): Ignore clobbers.
* constexpr.c (cxx_eval_store_expression): Ignore clobbers. (build_constexpr_constructor_member_initializers): Loop to find the BIND_EXPR. * decl.c (start_preparsed_function): Clobber the object at the beginning of a constructor. From-SVN: r222135
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 0538570..965f07c 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -13708,6 +13708,20 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
store_parm_decls (current_function_parms);
+ if (!processing_template_decl
+ && flag_lifetime_dse && DECL_CONSTRUCTOR_P (decl1))
+ {
+ /* Insert a clobber to let the back end know that the object storage
+ is dead when we enter the constructor. */
+ tree btype = CLASSTYPE_AS_BASE (current_class_type);
+ tree clobber = build_constructor (btype, NULL);
+ TREE_THIS_VOLATILE (clobber) = true;
+ tree bref = build_nop (build_reference_type (btype), current_class_ptr);
+ bref = convert_from_reference (bref);
+ tree exprstmt = build2 (MODIFY_EXPR, btype, bref, clobber);
+ finish_expr_stmt (exprstmt);
+ }
+
return true;
}