From patchwork Mon Jun 3 17:49:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 248370 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id E52602C00A4 for ; Tue, 4 Jun 2013 03:51:07 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :date:to:subject:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=GkTpM VkEebRo9xGB3y9BMe9FTi/Tw31dNo3QPAoD2vSQaRIzoP4huGKBztE/WtN7vQAmV wHIjjWoCrSC5/v8ZxkKwfTW8Oo5S7C+44G0R9NpJalfPsaR5ydAnifuRcNVFb6+j 9hJhNI5Ce9FKHaGr6ZxP314spV83rJMZIxv49A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :date:to:subject:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=wEZLVvscZfC JzNRFGHbBH16nYAw=; b=uhG7zjppB2SWG/xwyXzFDxQCWr/55XB/9rhMkw/9IJ4 5ZxadyThctpMJgte93MRawIlLt2/kA+fl6iBs9qLowKc2GkII7D3vxoPSU398xRs yYS4Du4dskUjDhrYt/MEmvjIvaiHRhjx+uubvMQEZfHZbPEmbLChJpPyOnsIwkro = Received: (qmail 25039 invoked by alias); 3 Jun 2013 17:51:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 25030 invoked by uid 89); 3 Jun 2013 17:51:00 -0000 X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from multi.imgtec.com (HELO multi.imgtec.com) (194.200.65.239) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 03 Jun 2013 17:51:00 +0000 From: "Steve Ellcey " Date: Mon, 3 Jun 2013 10:49:57 -0700 To: , Subject: [patch, testsuite, cilk] Fix cilk tests for simulators User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 Message-ID: <29224af6-f1d5-435e-97dd-ddc463fe534c@BAMAIL02.ba.imgtec.org> X-SEF-Processed: 7_3_0_01192__2013_06_03_18_50_54 A number of the new cilk tests in gcc/testsuite/c-c++-common/cilk-plus/AN fail for me when run via the gnu simulator on mips. The problem is that the gnu simulator does not set up argc and argv. After asking in the gdb mailing list I believe this is an issue for multiple simulators on multiple platforms. Looking through the GCC testsuite I did not see any other tests that looked at argc/argv so I would like to change these tests to not use argc/argv either. In some tests I added a define (IN_GCC_TESTSUITE) that I set to 1 and then don't check argc if this is set, in others I just used the constant value 1 instead of using argc and in one (where argc was being changed) I replaced the use of argc with a local variable. Tested on mips-mti-elf with the GNU simulator. OK to checkin? 2013-06-03 Steve Ellcey * c-c++-common/cilk-plus/AN/array_test2.c: Do not check argc value. * c-c++-common/cilk-plus/AN/array_test_ND.c: Ditto. * c-c++-common/cilk-plus/AN/comma_exp.c: Ditto. * c-c++-common/cilk-plus/AN/if_test.c: Ditto. * c-c++-common/cilk-plus/AN/conditional.c: Replace argc with const 1. * c-c++-common/cilk-plus/AN/sec_reduce_return.c: Ditto. * c-c++-common/cilk-plus/AN/test_builtin_return.c: Ditto. * c-c++-common/cilk-plus/AN/exec-once2.c: Replace argc with local var. diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test2.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test2.c index bd7a4ad..178bba6 100644 --- a/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test2.c +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test2.c @@ -1,12 +1,12 @@ /* { dg-do run } */ -/* { dg-options "-fcilkplus" } */ +/* { dg-options "-fcilkplus -DIN_GCC_TESTSUITE=1" } */ #include int main2(int argc, char **argv); int main(int argc, char **argv) { int x = 0; - if (argc == 1) + if (argc == 1 || IN_GCC_TESTSUITE) { const char *array[] = {"a.out", "5"}; x = main2 (2, (char **)array); diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test_ND.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test_ND.c index 1431c22..441342b 100644 --- a/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test_ND.c +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/array_test_ND.c @@ -1,12 +1,12 @@ /* { dg-do run } */ -/* { dg-options "-fcilkplus" } */ +/* { dg-options "-fcilkplus -DIN_GCC_TESTSUITE=1" } */ #include int main2(int argc, char **argv); int main(int argc, char **argv) { int x = 0; - if (argc == 1) + if (argc == 1 || IN_GCC_TESTSUITE) { const char *array[] = {"a.out", "10", "15"}; x = main2 (3, (char **)array); diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/comma_exp.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/comma_exp.c index bcb3e1b..43138bb 100644 --- a/gcc/testsuite/c-c++-common/cilk-plus/AN/comma_exp.c +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/comma_exp.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-fcilkplus" } */ +/* { dg-options "-fcilkplus -DIN_GCC_TESTSUITE" } */ #include @@ -7,7 +7,7 @@ int main2 (int argc, char **argv); int main(int argc, char **argv) { int x = 0; - if (argc == 1) + if (argc == 1 || IN_GCC_TESTSUITE) { const char *array[] = {"a.out", "5"}; x = main2 (2, (char **)array); diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/conditional.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/conditional.c index 0be99b2..4345a26 100644 --- a/gcc/testsuite/c-c++-common/cilk-plus/AN/conditional.c +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/conditional.c @@ -31,7 +31,7 @@ int main(int argc, char **argv) array[ii] = 3; } array3 = (short *) malloc (sizeof (short) * 1000); - array3[0:1000:argc] = cond[:] ? array[0:(argc * 1000)] : array2[argc-1:1000]; + array3[0:1000:1] = cond[:] ? array[0:(1 * 1000)] : array2[0:1000]; for (ii = 0; ii < 1000; ii++) { if ((cond[ii] == 0 && array3[ii] != 5) diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once2.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once2.c index 8d208b9..6cbfb66 100644 --- a/gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once2.c +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once2.c @@ -34,23 +34,23 @@ int func4(int x) } -/* This program makes an assumption that argc == 1. */ int main (int argc, char **argv) { int array[2500]; + int i = 1; /* This should set array[0->999] to 5. */ - array[argc-1:func2(++argc):1] = 5; + array[i-1:func2(++i):1] = 5; array[1000:500:1] = 10; /* set all variables in array[1000-->1499] to 10. */ array[1500:500:1] = 15; /* set all variables in array[1500-->1999] to 15. */ array[2000:500:1] = 20; /* set all variables in array[2000-->2499] to 20. */ array[2000:500:1] = 25; /* set all variables in array[2500-->2999] to 25. */ array[2000:500:1] = 30; /* set all variables in array[3000-->3499] to 30. */ - argc = func3 (argc); /* This will set argc back to 1. */ + i = func3 (i); /* This will set i back to 1. */ #if HAVE_IO - printf("argc = %d\n", argc); + printf("i = %d\n", i); #endif /* If the parameters inside the function get evaluated only once, then this if statement must work fine, i.e. the triplet values will be 0, 1000, 1. @@ -58,7 +58,7 @@ int main (int argc, char **argv) Otherwise, the program should crash or give some uneasy value. */ /* If done correctly, it should boil down to: array[0:1000:1]. */ - if (array[func3(argc):func2(++argc)] != 5) { + if (array[func3(i):func2(++i)] != 5) { #ifdef HAVE_IO printf ("Should not be there(1).\n"); #endif @@ -66,7 +66,7 @@ int main (int argc, char **argv) } /* If done correctly, it should boil down to: array[999:500:-1]. */ - if (func4(array[func2(argc)-1:func2(argc--):func1(argc)]) != 5) { + if (func4(array[func2(i)-1:func2(i--):func1(i)]) != 5) { #ifdef HAVE_IO printf ("Should not be there(2).\n"); #endif @@ -74,7 +74,7 @@ int main (int argc, char **argv) } /* If done correctly, it should boil down to: array[1000:500:1]. */ - if (func4 (func4(array[func2(argc++):500: func1(argc--)])) != 5) { + if (func4 (func4(array[func2(i++):500: func1(i--)])) != 5) { #ifdef HAVE_IO printf ("Should not be there(3).\n"); #endif diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/if_test.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/if_test.c index 53ceeec..200e8b3 100644 --- a/gcc/testsuite/c-c++-common/cilk-plus/AN/if_test.c +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/if_test.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-fcilkplus" } */ +/* { dg-options "-fcilkplus -DIN_GCC_TESTSUITE=1" } */ #if HAVE_IO #include @@ -9,7 +9,7 @@ int main2 (int argc, char **argv); int main(int argc, char **argv) { int x = 0; - if (argc == 1) + if (argc == 1 || IN_GCC_TESTSUITE) { const char *array[] = {"a.out", "10", "15"}; x = main2 (3, (char **) array); diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_reduce_return.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_reduce_return.c index a72cfaf..107bbe4 100644 --- a/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_reduce_return.c +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/sec_reduce_return.c @@ -15,7 +15,7 @@ int main (int argc, char **argv) { int array[10000]; - array[:] = argc; /* All elements should be one. */ + array[:] = 1; /* All elements should be one. */ if (add_all (array, 10000) != 10000) return 1; diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/test_builtin_return.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/test_builtin_return.c index 0df324a..78e2dc2 100644 --- a/gcc/testsuite/c-c++-common/cilk-plus/AN/test_builtin_return.c +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/test_builtin_return.c @@ -35,8 +35,8 @@ int main(int argc, char **argv) int ii = 0; for (ii = 0; ii < NUMBER; ii++) { - array[ii] = argc; /* This should calculate to 1. */ - array2[ii] = argc * argc + argc; /* This should calculate to 2. */ + array[ii] = 1; + array2[ii] = 2; } return_value = func1 (array, array2);