(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.c-torture/
compile/
pr37669.c
       1  /* This testcase used to fail because a miscompiled execute_fold_all_builtins. */
       2  /* { dg-options "-fgnu89-inline" } */
       3  /* { dg-require-effective-target int32plus } */
       4  /* { dg-skip-if "too many arguments in function call" { bpf-*-* } } */
       5  
       6  typedef __SIZE_TYPE__ size_t;
       7  extern __inline __attribute__ ((__always_inline__)) int __attribute__
       8  ((__nothrow__)) snprintf (char *__restrict __s, size_t __n, __const char
       9  *__restrict __fmt, ...)  {
      10    return __builtin___snprintf_chk (__s, __n, 2 - 1,       
      11  __builtin_object_size (__s, 2 > 1), __fmt, __builtin_va_arg_pack ());
      12  }
      13  int n1, n2, n3, n4, f5, f6;
      14  char * BackgroundGetUniqueString(void)
      15  {
      16    char s[256];
      17    const char *chmap =
      18  "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_";
      19    snprintf(s, sizeof(s),
      20  "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
      21             chmap[(n1 >> 0) & 0x3f], chmap[(n1 >> 6) & 0x3f],
      22             chmap[(n1 >> 12) & 0x3f], chmap[(n1 >> 18) & 0x3f],
      23             chmap[(n1 >> 24) & 0x3f], chmap[(n1 >> 28) & 0x3f],
      24             chmap[(n2 >> 0) & 0x3f], chmap[(n2 >> 6) & 0x3f],
      25             chmap[(n2 >> 12) & 0x3f], chmap[(n2 >> 18) & 0x3f],
      26             chmap[(n2 >> 24) & 0x3f], chmap[(n2 >> 28) & 0x3f],
      27             chmap[(n3 >> 0) & 0x3f], chmap[(n3 >> 6) & 0x3f],
      28             chmap[(n3 >> 12) & 0x3f], chmap[(n3 >> 18) & 0x3f],
      29             chmap[(n3 >> 24) & 0x3f], chmap[(n3 >> 28) & 0x3f],
      30             chmap[(n4 >> 0) & 0x3f], chmap[(n4 >> 6) & 0x3f],
      31             chmap[(n4 >> 12) & 0x3f], chmap[(n4 >> 18) & 0x3f],
      32             chmap[(n4 >> 24) & 0x3f], chmap[(n4 >> 28) & 0x3f],
      33             chmap[(f5 >> 12) & 0x3f], chmap[(f5 >> 18) & 0x3f],
      34             chmap[(f5 >> 24) & 0x3f], chmap[(f5 >> 28) & 0x3f],
      35             chmap[(f6 >> 0) & 0x3f], chmap[(f6 >> 6) & 0x3f]
      36             );
      37    return __builtin_strdup(s);
      38  }