modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/pr88693.c (about)

     1  /* PR tree-optimization/88693 */
     2  
     3  __attribute__((noipa)) void
     4  foo (char *p)
     5  {
     6    if (__builtin_strlen (p) != 9)
     7      __builtin_abort ();
     8  }
     9  
    10  __attribute__((noipa)) void
    11  quux (char *p)
    12  {
    13    int i;
    14    for (i = 0; i < 100; i++)
    15      if (p[i] != 'x')
    16        __builtin_abort ();
    17  }
    18  
    19  __attribute__((noipa)) void
    20  qux (void)
    21  {
    22    char b[100];
    23    __builtin_memset (b, 'x', sizeof (b));
    24    quux (b);
    25  }
    26  
    27  __attribute__((noipa)) void
    28  bar (void)
    29  {
    30    static unsigned char u[9] = "abcdefghi";
    31    char b[100];
    32    __builtin_memcpy (b, u, sizeof (u));
    33    b[sizeof (u)] = 0;
    34    foo (b);
    35  }
    36  
    37  __attribute__((noipa)) void
    38  baz (void)
    39  {
    40    static unsigned char u[] = { 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r' };
    41    char b[100];
    42    __builtin_memcpy (b, u, sizeof (u));
    43    b[sizeof (u)] = 0;
    44    foo (b);
    45  }
    46  
    47  int
    48  main ()
    49  {
    50    qux ();
    51    bar ();
    52    baz ();
    53    return 0;
    54  }