This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Avoid needless unsharing during constexpr evaluation (PR c++/70452)
- From: Markus Trippelsdorf <markus at trippelsdorf dot de>
- To: Patrick Palka <patrick at parcs dot ath dot cx>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>
- Date: Fri, 8 Apr 2016 09:12:01 +0200
- Subject: Re: [PATCH] Avoid needless unsharing during constexpr evaluation (PR c++/70452)
- Authentication-results: sourceware.org; auth=none
- References: <1459961500-8709-1-git-send-email-patrick at parcs dot ath dot cx> <23BF17BD-8114-4EAF-9D97-43718D6BB900 at gmail dot com> <CA+C-WL8ZFHcUrOhhbjaTjTwNm2pkM2OjXa+xFOuaCKur2uk9OQ at mail dot gmail dot com> <alpine dot DEB dot 2 dot 20 dot 11 dot 1604061819540 dot 2715 at idea>
On 2016.04.06 at 18:25 -0400, Patrick Palka wrote:
> On Wed, 6 Apr 2016, Patrick Palka wrote:
> Here is a safer and simpler approach that just walks the expression
> being unshared to try to find a CONSTRUCTOR node. If it finds one, then
> we unshare the whole expression. Otherwise we return the original
> expression. It should be completely safe to avoid unsharing an
> expression if it contains no CONSTRUCTOR nodes.
>
> gcc/cp/ChangeLog:
>
> PR c++/70452
> * constexpr.c (find_constructor): New function.
> (unshare_constructor): New function.
> (cxx_eval_call_expression): Use unshare_constructor instead of
> unshare_expr.
> (find_array_ctor_elt): Likewise.
> (cxx_eval_vec_init_1): Likewise.
> (cxx_eval_store_expression): Likewise.
> (cxx_eval_constant_expression): Likewise.
This patch causes: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70590
--
Markus