cgraph_copy_node_for_versioning duplicate a node but it does not call cgraph_call_node_duplication_hooks (as in cgraph_clone_node). So the vector is not resized for the new node.

Bootstrapped and tested with no new regression on linux-x86-64.
(Don't have any account so please commit if ok)

Patrick Marlier.
2011-11-27  Patrick Marlier  <patrick.marl...@gmail.com>

        PR middle-end/51273
        * cgraph.h (cgraph_call_node_duplication_hooks): Declare.
        * cgraph.c (cgraph_call_node_duplication_hooks): Make global. 
        * cgraphunit.c (cgraph_copy_node_for_versioning): Call duplication
        hooks.
Index: cgraphunit.c
===================================================================
--- cgraphunit.c	(revision 181766)
+++ cgraphunit.c	(working copy)
@@ -2318,6 +2318,8 @@ cgraph_copy_node_for_versioning (struct cgraph_nod
        cgraph_redirect_edge_callee (e, new_version);
      }
 
+   cgraph_call_node_duplication_hooks (old_version, new_version);
+
    return new_version;
  }
 
Index: cgraph.h
===================================================================
--- cgraph.h	(revision 181766)
+++ cgraph.h	(working copy)
@@ -513,6 +513,8 @@ struct cgraph_node * cgraph_clone_node (struct cgr
 					int, bool, VEC(cgraph_edge_p,heap) *,
 					bool);
 struct cgraph_node *cgraph_create_function_alias (tree, tree);
+void cgraph_call_node_duplication_hooks (struct cgraph_node *node1,
+					 struct cgraph_node *node2);
 
 void cgraph_redirect_edge_callee (struct cgraph_edge *, struct cgraph_node *);
 void cgraph_make_edge_direct (struct cgraph_edge *, struct cgraph_node *);
Index: cgraph.c
===================================================================
--- cgraph.c	(revision 181766)
+++ cgraph.c	(working copy)
@@ -412,7 +412,7 @@ cgraph_remove_node_duplication_hook (struct cgraph
 }
 
 /* Call all node duplication hooks.  */
-static void
+void
 cgraph_call_node_duplication_hooks (struct cgraph_node *node1,
 				    struct cgraph_node *node2)
 {

Reply via email to