(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.c-torture/
execute/
20050218-1.c
       1  /* PR tree-optimization/19828 */
       2  typedef __SIZE_TYPE__ size_t;
       3  extern size_t strlen (const char *s);
       4  extern int strncmp (const char *s1, const char *s2, size_t n);
       5  extern void abort (void);
       6  
       7  const char *a[16] = { "a", "bc", "de", "fgh" };
       8  
       9  int
      10  foo (char *x, const char *y, size_t n)
      11  {
      12    size_t i, j = 0;
      13    for (i = 0; i < n; i++)
      14      {
      15        if (strncmp (x + j, a[i], strlen (a[i])) != 0)
      16          return 2;
      17        j += strlen (a[i]);
      18        if (y)
      19          j += strlen (y);
      20      }
      21    return 0;
      22  }
      23  
      24  int
      25  main (void)
      26  {
      27    if (foo ("abcde", (const char *) 0, 3) != 0)
      28      abort ();
      29    return 0;
      30  }