2014-10-24 Christophe Lyon <christophe.lyon@linaro.org>
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr43417.c
blob67b1158950b3707fa5f276cfec11caa84d82d420
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -m4" } */
4 int pid_count = 0;
6 unsigned int getopt (int, const char**, const char*);
7 unsigned long long atoll (const char*);
8 int fork (void);
9 void kill (int, int);
11 int
12 main (int argc, const char *argv[])
14 unsigned int c;
15 unsigned long long maxbytes = 0;
16 extern const char *optarg;
17 int i;
18 int pid_cntr;
19 int pid;
20 int pid_list[1000];
21 while ((c = getopt (argc, argv, "c:b:p:wvh")) != (-1))
23 switch ((char) c)
25 case 'b':
26 maxbytes = atoll (optarg);
29 pid = fork ();
30 while ((pid != 0) && (maxbytes > 1024 * 1024 * 1024))
32 maxbytes = maxbytes - (1024 * 1024 * 1024);
33 pid = fork ();
34 if (pid != 0)
35 pid_cntr++;
36 pid_list[i] = pid;
38 while ((pid_count < pid_cntr))
41 kill (pid_list[i], 9);