char buf[64];
void bar (int);
void
foo (void)
{
  int i;
  const char *ext = 0;
  for (i = 1; i < 3; i++)
    {
      if (i == 1)
        ext = "extern  ";
      bar (i);
      __builtin_strcpy (buf, ext);
      bar (i);
    }
}

ICEs at -O2 on x86_64-redhat-linux (but likely any other target).
In:
      /* FIXME.  If REPL is a constant, we need to fold STMT.
         However, fold_stmt wants a pointer to the statement, because
         it may happen that it needs to replace the whole statement
         with a new expression.  Since the current def-use machinery
         does not return pointers to statements, we call fold_stmt
         with the address of a local temporary, if that call changes
         the temporary then we fall on our swords.

         Note that all this will become unnecessary soon.  This
         pass is being replaced with a proper copy propagation pass
         for 4.1 (dnovillo, 2004-09-17).  */
      if (TREE_CODE (repl) != SSA_NAME)
        {
          tree tmp = stmt;
          fold_stmt (&tmp);
          if (tmp != stmt)
            abort ();
        }
that fold_stmt changes
__builtin_strcpy (&bufD.1464, &"extern  "[0])
into
__builtin_memcpy (&bufD.1464, &"extern  "[0], 9)
and as tmp != stmt it aborts.

-- 
           Summary: ICE in replace_immediate_uses
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
                CC: dnovillo at redhat dot com,drepper at redhat dot
                    com,gcc-bugs at gcc dot gnu dot org


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

Reply via email to