This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Add a test case for PR target/43417
- From: Jie Zhang <jie at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 10 Apr 2010 19:52:27 +0800
- Subject: [PATCH] Add a test case for PR target/43417
I just found there is no test case for PR target/43417 in GCC testsuite.
This patch adds it. I also found that that PR can only be reproduced
with -m4.
This test case is reduced from a LTP test reported by one of our
customers. It might be same as the test code in that PR considering its
name also starts with mtest01.
Is it OK?
--
Jie Zhang
CodeSourcery
(650) 331-3385 x735
PR target/43417
* gcc.target/sh/pr43417.c: New test.
Index: gcc.target/sh/pr43417.c
===================================================================
--- gcc.target/sh/pr43417.c (revision 0)
+++ gcc.target/sh/pr43417.c (revision 0)
@@ -0,0 +1,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);
+}
+