(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
pr86114.c
       1  /* PR tree-optimization/86114 - ICE in gimple_fold_builtin_strlen with
       2     an invalid call to strnlen
       3     { dg-do compile }
       4     { dg-options "-O2" }  */
       5  
       6  typedef __SIZE_TYPE__ size_t;
       7  
       8  extern char* strcmp (const char*, const char*);
       9  extern char* strncmp (const char*, const char*, size_t);
      10  extern char* strlen (const char*);
      11  extern char* strnlen (const char*, size_t);
      12  extern char* strcspn (const char*, const char*);
      13  extern char* strspn (const char*, const char*);
      14  extern char* strxfrm (const char*, const char*, size_t);
      15  
      16  char** q;
      17  
      18  void test_array (const char *s)
      19  {
      20    extern char a[8];
      21  
      22    q[0] = strcmp (a, s);
      23    q[1] = strncmp (a, s, 7);
      24    q[2] = strlen (a);
      25    q[3] = strnlen (a, 7);
      26    q[4] = strcspn (a, s);
      27    q[5] = strspn (a, s);
      28    q[6] = strxfrm (a, s, 7);
      29  }
      30  
      31  void test_pointer (const char *s, const char *t)
      32  {
      33    q[0] = strcmp (s, t);
      34    q[1] = strncmp (s, t, 7);
      35    q[2] = strlen (s);
      36    q[3] = strnlen (s, 7);
      37    q[4] = strcspn (s, t);
      38    q[5] = strspn (s, t);
      39    q[6] = strxfrm (s, s, 7);
      40  }
      41  
      42  /* { dg-prune-output "-Wbuiltin-declaration-mismatch" } */