https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98668

            Bug ID: 98668
           Summary: unused branch found in
                    gcc/passes.c:do_per_function_toporder
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ashimida at linux dot alibaba.com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

during ipa passes execution, do_per_function_toporder is called to execute sub
passes in execute_ipa_pass_list (opt_pass *pass):
## passses.c
2988 void
2989 execute_ipa_pass_list (opt_pass *pass)
2990 {
2991   do
2992     {
2993       gcc_assert (!current_function_decl);
2994       gcc_assert (!cfun);
2995       gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type ==
IPA_PASS);
2996       if (execute_one_pass (pass) && pass->sub)
2997         {
2998           if (pass->sub->type == GIMPLE_PASS)
2999             {
3000               invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_START,
NULL);
3001               do_per_function_toporder ((void (*)(function *, void *))
3002                                           execute_pass_list,
3003                                         pass->sub);
......
## passes.c
1735 void
1736 do_per_function_toporder (void (*callback) (function *, void *data), void
*data)
1737 {
1738   int i;
1739 
1740   if (current_function_decl)
1741     callback (cfun, data);
1742   else
1743     {
1744       hash_set<cgraph_node *> removed_nodes;

when do_per_function_toporder is running, it should always have a context with
current_function_decl = cfunc = NULL, so codes in
do_per_function_toporder[1740,1742] should be deleted or changed to:

gcc_assert(!current_function_decl)
gcc_assert(!cfun)

(Or am I missing something?)
  • [Bug ipa/98668] New: unused... ashimida at linux dot alibaba.com via Gcc-bugs

Reply via email to