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

     1  /* { dg-skip-if "requires alloca" { ! alloca } { "-O0" } { "" } } */
     2  extern void abort (void);
     3  
     4  extern __SIZE_TYPE__ strlen (const char *);
     5  void foo(char *str)
     6  {
     7    int len2 = strlen (str);
     8    char *a = (char *) __builtin_alloca (0);
     9    char *b = (char *) __builtin_alloca (len2*3);
    10  
    11    if ((int) (a-b) < (len2*3))
    12      {
    13  #ifdef _WIN32
    14        abort ();
    15  #endif
    16        return;
    17      }
    18  }
    19  
    20  static char * volatile argp = "pr36321.x";
    21  
    22  int main(int argc, char **argv)
    23  {
    24    foo (argp);
    25    return 0;
    26  }
    27