modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/compile/20031023-1.c (about)

     1  /* Declaration of the frame size doesn't work on ptx.  */
     2  /* { dg-require-effective-target untyped_assembly } */
     3  #ifndef ASIZE
     4  # define ASIZE 0x10000000000UL
     5  #endif
     6  
     7  #include <limits.h>
     8  
     9  #if LONG_MAX < 8 * ASIZE
    10  # undef ASIZE
    11  # define ASIZE 4096
    12  #endif
    13  
    14  extern void abort (void);
    15  
    16  int __attribute__((noinline))
    17  foo (const char *s)
    18  {
    19    if (!s)
    20      return 1;
    21    if (s[0] != 'a')
    22      abort ();
    23    s += ASIZE - 1;
    24    if (s[0] != 'b')
    25      abort ();
    26    return 0;
    27  }
    28  
    29  int (*fn) (const char *) = foo;
    30  
    31  int __attribute__((noinline))
    32  bar (void)
    33  {
    34    char s[ASIZE];
    35    s[0] = 'a';
    36    s[ASIZE - 1] = 'b';
    37    foo (s);
    38    foo (s);
    39    return 0;
    40  }
    41  
    42  int __attribute__((noinline))
    43  baz (long i)
    44  {
    45    if (i)
    46      return fn (0);
    47    else
    48      {
    49        char s[ASIZE];
    50        s[0] = 'a';
    51        s[ASIZE - 1] = 'b';
    52        foo (s);
    53        foo (s);
    54        return fn (0);
    55      }
    56  }
    57  
    58  int
    59  main (void)
    60  {
    61    if (bar ())
    62      abort ();
    63    if (baz (0) != 1)
    64      abort ();
    65    if (baz (1) != 1)
    66      abort ();
    67    return 0;
    68  }