[PATCH] Avoid needless unsharing during constexpr evaluation (PR c++/70452)

Markus Trippelsdorf markus@trippelsdorf.de
Fri Apr 8 07:12:00 GMT 2016


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



More information about the Gcc-patches mailing list