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

     1  /* PR rtl-optimization/61673 */
     2  
     3  char e;
     4  
     5  __attribute__((noinline, noclone)) void
     6  bar (char x)
     7  {
     8    if (x != 0x54 && x != (char) 0x87)
     9      __builtin_abort ();
    10  }
    11  
    12  __attribute__((noinline, noclone)) void
    13  foo (const char *x)
    14  {
    15    char d = x[0];
    16    int c = d;
    17    if ((c >= 0 && c <= 0x7f) == 0)
    18      e = d;
    19    bar (d);
    20  }
    21  
    22  __attribute__((noinline, noclone)) void
    23  baz (const char *x)
    24  {
    25    char d = x[0];
    26    int c = d;
    27    if ((c >= 0 && c <= 0x7f) == 0)
    28      e = d;
    29  }
    30  
    31  int
    32  main ()
    33  {
    34    const char c[] = { 0x54, 0x87 };
    35    e = 0x21;
    36    foo (c);
    37    if (e != 0x21)
    38      __builtin_abort ();
    39    foo (c + 1);
    40    if (e != (char) 0x87)
    41      __builtin_abort ();
    42    e = 0x21;
    43    baz (c);
    44    if (e != 0x21)
    45      __builtin_abort ();
    46    baz (c + 1);
    47    if (e != (char) 0x87)
    48      __builtin_abort ();
    49    return 0;
    50  }