Question

I have been writing a GCC inter procedural plugin where I have to insert GIMPLE statements at certain points in the program. After this I perform a data flow analysis on the complete program. When I am done with my analysis I am removing those newly inserted GIMPLE statements.

My analysis is getting completed but just before exiting from it the following message is generated:

internal compiler error: in execute_ipa_pass_list, at passes.c:1817

This is surely because of the insertion of GIMPLE statements, if I don't do that I won't get this error message.

Could anyone help me out and explain what is the problem and how to fix it?

No correct solution

OTHER TIPS

This usually happens when GCC code contains an assertion which turns out to be false.

The line 1817 in passes.c (which is part of the GCC sources, in the gcc sub-directory of the GCC source tree) has a piece of code which looks like:

gcc_assert (some_condition);

In your case, some_condition was false, but the compiler expects it to be always true (this is why the author of the code wrote the assertion in the first place).

You did something in your plugin which made it false, and you need to fix it.

What did you do wrong? It really depends. Open up passes.c and find that line, and see what it is checking. In my copy of GCC, the relevant function reads:

void
execute_ipa_pass_list (struct opt_pass *pass)
{
  do
    {
      /* An assertion.  */
      gcc_assert (!current_function_decl);
      /* Another assertion.  */
      gcc_assert (!cfun);
      /* Another assertion.  */
      gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
      if (execute_one_pass (pass) && pass->sub)
        {
          if (pass->sub->type == GIMPLE_PASS)
            {
              invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_START, NULL);
              do_per_function_toporder ((void (*)(void *))execute_pass_list,
                                        pass->sub);
              invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_END, NULL);
            }
          else if (pass->sub->type == SIMPLE_IPA_PASS
                   || pass->sub->type == IPA_PASS)
            execute_ipa_pass_list (pass->sub);
          else
            gcc_unreachable ();
        }
      /* Another assertion.  */
      gcc_assert (!current_function_decl);
      cgraph_process_new_functions ();
      pass = pass->next;
    }
  while (pass);
}

There are four gcc_assert statements. Your plugin caused one of them to become false. i.e. you messed with one of the variables:

current_function_decl
cfun
pass->type

This is probably what's wrong.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top