http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47265

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-25 
10:27:41 UTC ---
Actually, there is a far easier fix.  Either add
  if (all && !has_zero_uses (name))
    all = false;
to the end of forward_propagate_addr_expr, or we could iterate some more,
either like this:
--- gcc/tree-ssa-forwprop.c.jj     2011-01-15 11:26:42.000000000 +0100
+++ gcc/tree-ssa-forwprop.c 2011-01-25 11:22:02.828495766 +0100
@@ -1061,6 +1061,8 @@ forward_propagate_addr_expr (tree name, 
   bool all = true;
   bool single_use_p = has_single_use (name);

+  do
+  {
   FOR_EACH_IMM_USE_STMT (use_stmt, iter, name)
     {
       bool result;
@@ -1113,6 +1115,7 @@ forward_propagate_addr_expr (tree name, 
          gsi_remove (&gsi, true);
        }
     }
+  } while (all && !has_zero_uses (name));

   return all;
 }

or say just once or say 4 times:
  int i;
  for (i = 0; i < 4; i++)
    {
      FOR_EACH_IMM_USE_STMT (use_stmt, iter, name)
        {
          ...
        }
      if (!all || has_zero_uses (name))
        return all;
    }
  return false;

Reply via email to