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

            Bug ID: 102725
           Summary: [12 Regression] -fno-builtin leads to call of strlen
                    since r12-4283-g6f966f06146be768
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: stefansf at linux dot ibm.com
  Target Milestone: ---

I noticed that in valgrind package, where they define their own standard
library functions.

$ cat strlen.c
#include <stddef.h>

size_t mystrlen ( const char* str )
{
   size_t i = 0;
   while (str[i] != 0) i++;
   return i;
}

int main(int argc, char **argv)
{
  return mystrlen (argv[0]);
}

$ gcc strlen.c  -O3  -fno-builtin -S && grep "call.*strlen" strlen.s
        call    strlen
        call    strlen

Before your revision, no strlen was called.

Reply via email to