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

     1  int pid_count = 0;
     2  
     3  unsigned int getopt (int, const char**, const char*);
     4  unsigned long long atoll (const char*);
     5  int fork (void);
     6  void kill (int, int);
     7  
     8  int
     9  main (int argc, const char *argv[])
    10  {
    11    unsigned int c;
    12    unsigned long long maxbytes = 0;
    13    extern const char *optarg;
    14    int i;
    15    int pid_cntr;
    16    int pid;
    17    int pid_list[1000];
    18    while ((c = getopt (argc, argv, "c:b:p:wvh")) != (-1))
    19      {
    20        switch ((char) c)
    21  	{
    22  	case 'b':
    23  	  maxbytes = atoll (optarg);
    24  	}
    25      }
    26    pid = fork ();
    27    while ((pid != 0) && (maxbytes > 1024 * 1024 * 1024))
    28      {
    29        maxbytes = maxbytes - (1024 * 1024 * 1024);
    30        pid = fork ();
    31        if (pid != 0)
    32  	pid_cntr++;
    33        pid_list[i] = pid;
    34      }
    35    while ((pid_count < pid_cntr))
    36      {
    37      }
    38    kill (pid_list[i], 9);
    39  }