(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
strlenopt-29.c
       1  /* PR tree-optimization/71707 */
       2  /* { dg-do run } */
       3  /* { dg-options "-O2 -fdump-tree-strlen" } */
       4  
       5  #include "strlenopt.h"
       6  
       7  char a[32];
       8  size_t b;
       9  
      10  __attribute__((noinline, noclone)) char *
      11  foo (void)
      12  {
      13    char *p = memcpy (a, "a", 2) + 1;
      14    memcpy (&a[1], "b", 2);
      15    b = strlen (a) + strlen (&a[1]) + strlen (p);
      16    return p;
      17  }
      18  
      19  int
      20  main ()
      21  {
      22    if (foo () != &a[1] || b != 4)
      23      abort ();
      24    return 0;
      25  }
      26  
      27  /* { dg-final { scan-tree-dump-times "strlen \\(" 0 "strlen1" } } */