On 8/7/19 11:51 AM, Richard Biener wrote:
> I think the simplest way to achieve this is to not copy, aka clear,
> DECL_IS_OPERATOR_* when cloning and removing arguments
> (cloning for a constant align argument should be OK for example, as is
> for a constant address).  Or simply always when cloning.

Ok, then I'm suggesting following tested patch.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin
>From b7ed2c7c208e96ecff77a0127570a858a486c0b8 Mon Sep 17 00:00:00 2001
From: Martin Liska <mli...@suse.cz>
Date: Wed, 7 Aug 2019 12:00:58 +0200
Subject: [PATCH] When cloning set operator new/delete to false.

gcc/ChangeLog:

2019-08-07  Martin Liska  <mli...@suse.cz>

	* cgraphclones.c (set_new_clone_decl_and_node_flags): Drop
	IS_OPERATOR_NEW and IS_OPERATOR_DELETE.
	(create_version_clone_with_body): Likewise.
---
 gcc/cgraphclones.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index fd867ecac91..28cf2ecc411 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -248,6 +248,8 @@ set_new_clone_decl_and_node_flags (cgraph_node *new_node)
   DECL_VIRTUAL_P (new_node->decl) = 0;
   DECL_STATIC_CONSTRUCTOR (new_node->decl) = 0;
   DECL_STATIC_DESTRUCTOR (new_node->decl) = 0;
+  DECL_SET_IS_OPERATOR_NEW (new_node->decl, 0);
+  DECL_SET_IS_OPERATOR_DELETE (new_node->decl, 0);
 
   new_node->externally_visible = 0;
   new_node->local.local = 1;
@@ -1065,6 +1067,8 @@ cgraph_node::create_version_clone_with_body
   /* When the old decl was a con-/destructor make sure the clone isn't.  */
   DECL_STATIC_CONSTRUCTOR (new_decl) = 0;
   DECL_STATIC_DESTRUCTOR (new_decl) = 0;
+  DECL_SET_IS_OPERATOR_NEW (new_decl, 0);
+  DECL_SET_IS_OPERATOR_DELETE (new_decl, 0);
 
   /* Create the new version's call-graph node.
      and update the edges of the new node. */
-- 
2.22.0

Reply via email to