===================================================================
@@ -1128,6 +1128,8 @@ free_node (tree node)
/* Return a new node with the same contents as NODE except that its
TREE_CHAIN, if it has one, is zero and it has a fresh uid. */
+bool clone_uid;
+
tree
copy_node_stat (tree node MEM_STAT_DECL)
{
@@ -1149,7 +1151,9 @@ copy_node_stat (tree node MEM_STAT_DECL)
if (TREE_CODE_CLASS (code) == tcc_declaration)
{
- if (code == DEBUG_EXPR_DECL)
+ if (clone_uid)
+ DECL_UID (t) = DECL_UID (node);
+ else if (code == DEBUG_EXPR_DECL)
DECL_UID (t) = --next_debug_decl_uid;
else
{
===================================================================
@@ -6100,6 +6100,18 @@ build_duplicate_type (tree type)
return type;
}
+static tree
+copy_decl_no_change_uid (tree decl, copy_body_data *id)
+{
+ extern bool clone_uid;
+
+ clone_uid = true;
+ tree r = copy_decl_no_change (decl, id);
+ clone_uid = false;
+
+ return r;
+}
+
/* Unshare the entire DECL_SAVED_TREE of FN and return the remapped
parameters and RESULT_DECL in PARMS and RESULT. Used by C++ constexpr
evaluation. */
@@ -6120,7 +6132,7 @@ copy_fn (tree fn, tree& parms, tree& res
id.src_cfun = DECL_STRUCT_FUNCTION (fn);
id.decl_map = &decl_map;
- id.copy_decl = copy_decl_no_change;
+ id.copy_decl = copy_decl_no_change_uid;
id.transform_call_graph_edges = CB_CGE_DUPLICATE;
id.transform_new_cfg = false;
id.transform_return_to_modify = false;