I am trying to copy a function like this- struct cgraph_node *dup_node, *cur_node=cgraph_get_node(current_function_decl); dup_node=cgraph_function_versioning(cur_node,NULL,NULL,NULL,0,NULL,NULL,"duplicate"); But it is giving error- In file included from :1:0: test.c:3:5: internal compiler error: in execute_one_pass, at passes.c:2026 The lines near 2026 in passes.c are- /* IPA passes are executed on whole program, so cfun should be NULL. Other passes need function context set. */ if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS) gcc_assert (!cfun && !current_function_decl); else 2026: gcc_assert (cfun && current_function_decl); How do I solve this problem? Am I doing right by using cgraph_function_versioning() function? On Fri, Jul 19, 2013 at 11:23 PM, Deepak Aggrawal <deepak.kansl@xxxxxxxxx> wrote: > hi, > I need to copy a whole control flow graph for a function in my > plugin. Is there any function provided by gcc that does that? > Thanks.