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

--- Comment #4 from Sebastian Pop <spop at gcc dot gnu.org> ---
The problem is in the recursion step of
fsm_find_control_statement_thread_paths:


  for (i = 0; i < gimple_phi_num_args (phi); i++)
    {
      tree arg = gimple_phi_arg_def (phi, i);
      basic_block bbi = gimple_phi_arg_edge (phi, i)->src;
[...]
      if (TREE_CODE (arg) == SSA_NAME)
    {
      vec_safe_push (path, bbi);
      /* Recursively follow SSA_NAMEs looking for a constant definition.  */
      fsm_find_control_statement_thread_paths (arg, visited_phis, path);
      path->pop ();
      continue;
    }

We are not supposed to register a jump-thread following only one of the PHI
arguments, as the other arguments may resolve into a non-constant or a
different constant.

In the current case, we have 

      c = x->c1[x->c2];
      switch (a)
    {
    case 0:
      if (c == ' ')
        x->c2++;
      else if (c == '/')
        {
          a = 4;   // here is the first argument of the phi node
          j = x->c2++;
        }
      else
        a = b;    // recursive call will follow b and resolve into 15

         // here the phi node looks like
         // a0 = phi (4, b)

      break;
    case 1:
      switch (c)
        {
        case '{':
          a = 0;
          b = 15;
          f = f10 ();
          x->c2++;
          break;

Reply via email to