(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
pr81292-1.c
       1  /* { dg-do run } */
       2  /* { dg-options "-O2 -fdump-tree-strlen" } */
       3  
       4  #include "strlenopt.h"
       5  
       6  char a[10];
       7  
       8  int __attribute__ ((noinline, noclone))
       9  f1 (int n)
      10  {
      11    a[0] = '1';
      12    a[1] = '2';
      13    return strlen (a + 1) < n ? strlen (a) : 100;
      14  }
      15  
      16  int __attribute__ ((noinline, noclone))
      17  f2 (char *a, int n)
      18  {
      19    a[0] = '1';
      20    a[1] = '2';
      21    return strlen (a + 1) < n ? strlen (a) : 100;
      22  }
      23  
      24  int
      25  main (void)
      26  {
      27    char b[10];
      28    strcpy (a + 2, "345");
      29    strcpy (b + 2, "34567");
      30    if (f1 (100) != 5 || f2 (b, 100) != 7)
      31      __builtin_abort ();
      32    return 0;
      33  }
      34  
      35  /* { dg-final { scan-tree-dump-times "strlen \\(" 2 "strlen1" } } */