From 3bdf0a9ba51c25ab13d5f37e311d77c12aca55ae Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 19 Nov 2014 14:03:20 -0500 Subject: [PATCH] re PR c++/63928 (use after free in cp/constexpr.c) PR c++/63928 * constexpr.c (cxx_eval_store_expression): Return init, not *valp. From-SVN: r217790 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/constexpr.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 13a9965cee8..ac4d2a53f25 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-11-19 Jason Merrill + + PR c++/63928 + * constexpr.c (cxx_eval_store_expression): Return init, not *valp. + 2014-11-19 Paolo Carlini PR c++/55425 diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index d98d9b9259e..77f5159a0fd 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -2554,7 +2554,7 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t, else if (addr) return target; else - return *valp; + return init; } /* Evaluate a ++ or -- expression. */ -- 2.30.2