summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/sh/pr43417.c
blob: 081ff46b998b4249ed8bda41ea45f06b1cbcbf52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* { dg-do compile } */
/* { dg-options "-O2 -m4" } */

int pid_count = 0;
main (int argc, char *argv[])
{
  unsigned int c;
  unsigned long long maxbytes = 0;
  extern char *optarg;
  int i;
  int pid_cntr;
  int pid;
  int pid_list[1000];
  while ((c = getopt (argc, argv, "c:b:p:wvh")) != (-1))
    {
      switch ((char) c)
	{
	case 'b':
	  maxbytes = atoll (optarg);
	}
    }
  pid = fork ();
  while ((pid != 0) && (maxbytes > 1024 * 1024 * 1024))
    {
      maxbytes = maxbytes - (1024 * 1024 * 1024);
      pid = fork ();
      if (pid != 0)
	pid_cntr++;
      pid_list[i] = pid;
    }
  while ((pid_count < pid_cntr))
    {
    }
  kill (pid_list[i], 9);
}