diff options
Diffstat (limited to 'gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once.c')
-rw-r--r-- | gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once.c new file mode 100644 index 00000000000..00b018a2c85 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/exec-once.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-fcilkplus" } */ + +#define NUMBER 1000 + +#if HAVE_IO +#include <stdio.h> +#endif + +int func (int *x) +{ + int q = *x; + q++; + *x = q; +#if HAVE_IO + printf("%d\n", (q)); +#endif + return *x; +} +int main (void) +{ + char array[NUMBER], array2[NUMBER]; + int ii, d = 2; +#if 1 + for (ii = 0; ii < NUMBER; ii++) { + array[ii] = 5; + array2[ii]= 2; + } +#endif + d = func (&d); /* d = 1 */ + array2[:] = d * array[:] + (char) func (&d); /* 3 * 5 + 4 */ +#if HAVE_IO + for (ii = 0; ii < NUMBER; ii++) + printf("array2[%d] = %d\n", ii, array2[ii]); +#endif + for (ii = 0; ii < NUMBER; ii++) + if (array2[ii] != (3 * 5 + 4)) + return 1; + + return 0; +} + + + |