diff options
author | Jason Merrill <jason@redhat.com> | 2016-01-26 16:34:16 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2016-01-26 16:34:16 -0500 |
commit | ca30abcd13617314b7de526da03802639a2a7fc7 (patch) | |
tree | 39f30693c0fcb67ca9098ca43ad7fe4576d05c26 /gcc/cp/constexpr.c | |
parent | 2d63bc398f7221edbec3e3f1d4ecbacac87cb3a5 (diff) | |
download | gcc-ca30abcd13617314b7de526da03802639a2a7fc7.zip gcc-ca30abcd13617314b7de526da03802639a2a7fc7.tar.gz gcc-ca30abcd13617314b7de526da03802639a2a7fc7.tar.bz2 |
re PR c++/68949 (Implicit initialization of array member silently miscompiling.)
PR c++/68949
* constexpr.c (register_constexpr_fundef): Keep the un-massaged body.
(cxx_eval_call_expression): Don't look through clones.
* optimize.c (maybe_clone_body): Clear DECL_SAVED_TREE of the alias.
* semantics.c (expand_or_defer_fn_1): Keep DECL_SAVED_TREE of
maybe-in-charge *tor.
From-SVN: r232848
Diffstat (limited to 'gcc/cp/constexpr.c')
-rw-r--r-- | gcc/cp/constexpr.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index eed7308..bbb8ccf 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -769,23 +769,23 @@ register_constexpr_fundef (tree fun, tree body) if (!is_valid_constexpr_fn (fun, !DECL_GENERATED_P (fun))) return NULL; - body = massage_constexpr_body (fun, body); - if (body == NULL_TREE || body == error_mark_node) + tree massaged = massage_constexpr_body (fun, body); + if (massaged == NULL_TREE || massaged == error_mark_node) { if (!DECL_CONSTRUCTOR_P (fun)) error ("body of constexpr function %qD not a return-statement", fun); return NULL; } - if (!potential_rvalue_constant_expression (body)) + if (!potential_rvalue_constant_expression (massaged)) { if (!DECL_GENERATED_P (fun)) - require_potential_rvalue_constant_expression (body); + require_potential_rvalue_constant_expression (massaged); return NULL; } if (DECL_CONSTRUCTOR_P (fun) - && cx_check_missing_mem_inits (fun, body, !DECL_GENERATED_P (fun))) + && cx_check_missing_mem_inits (fun, massaged, !DECL_GENERATED_P (fun))) return NULL; /* Create the constexpr function table if necessary. */ @@ -1340,15 +1340,6 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, { if (!result || result == error_mark_node) { - if (DECL_SAVED_TREE (fun) == NULL_TREE - && (DECL_CONSTRUCTOR_P (fun) || DECL_DESTRUCTOR_P (fun))) - /* The maybe-in-charge 'tor had its DECL_SAVED_TREE - cleared, try a clone. */ - for (fun = DECL_CHAIN (fun); - fun && DECL_CLONED_FUNCTION_P (fun); - fun = DECL_CHAIN (fun)) - if (DECL_SAVED_TREE (fun)) - break; gcc_assert (DECL_SAVED_TREE (fun)); tree parms, res; |