[Bug tree-optimization/61056] New: strchr (x, 0) is not converted to strlen (x)

olegendo at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun May 4 16:22:00 GMT 2014


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

            Bug ID: 61056
           Summary: strchr (x, 0) is not converted to strlen (x)
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olegendo at gcc dot gnu.org
            Target: sh*-*-*

At least on SH and r210026 the following:

extern "C" const char* strchr (const char*,int);

const char* test (const char* x)
{
  return strrchr (x, 0);
}

does not get converted to a strlen (x).  It seems that tree-ssa-strlen is
trying to do something but always fails.



More information about the Gcc-bugs mailing list