2 /* { dg-options "-fcilkplus" } */
11 /* If x == 2 then it should return 0. */
17 /* If x == 2 then it should return 1000. */
23 /* If x == 2 then it should return 1. */
24 /* If x == 1 then it should return 0. */
37 /* This program makes an assumption that argc == 1. */
43 /* This is done to make sure the compiler does not optimize out argc. */
44 __asm
volatile ("" : "+r" (argc
));
45 /* This should set array[0->999] to 5. */
46 array
[argc
-1:func2(++argc
):1] = 5;
47 array
[1000:500:1] = 10; /* set all variables in array[1000-->1499] to 10. */
48 array
[1500:500:1] = 15; /* set all variables in array[1500-->1999] to 15. */
49 array
[2000:500:1] = 20; /* set all variables in array[2000-->2499] to 20. */
50 array
[2000:500:1] = 25; /* set all variables in array[2500-->2999] to 25. */
51 array
[2000:500:1] = 30; /* set all variables in array[3000-->3499] to 30. */
53 argc
= func3 (argc
); /* This will set argc back to 1. */
55 printf("argc = %d\n", argc
);
57 /* If the parameters inside the function get evaluated only once, then this
58 if statement must work fine, i.e. the triplet values will be 0, 1000, 1.
60 Otherwise, the program should crash or give some uneasy value. */
62 /* If done correctly, it should boil down to: array[0:1000:1]. */
63 if (array
[func3(argc
):func2(++argc
)] != 5) {
65 printf ("Should not be there(1).\n");
70 /* If done correctly, it should boil down to: array[999:500:-1]. */
71 if (func4(array
[func2(argc
)-1:func2(argc
--):func1(argc
)]) != 5) {
73 printf ("Should not be there(2).\n");
78 /* If done correctly, it should boil down to: array[1000:500:1]. */
79 if (func4 (func4(array
[func2(argc
++):500: func1(argc
--)])) != 5) {
81 printf ("Should not be there(3).\n");