diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/gomp/collapse-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/gomp/collapse-1.c | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/gomp/collapse-1.c b/gcc/testsuite/gcc.dg/gomp/collapse-1.c new file mode 100644 index 00000000000..89b76bb669c --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/collapse-1.c @@ -0,0 +1,92 @@ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +int i, j, k; +extern int foo (void); + +void +f1 (void) +{ + #pragma omp for collapse (2) + for (i = 0; i < 5; i++) + ; /* { dg-error "not enough perfectly nested" } */ + { + for (j = 0; j < 5; j++) + ; + } +} + +void +f2 (void) +{ + #pragma omp for collapse (2) + for (i = 0; i < 5; i++) + { + { + { + for (j = 0; j < 5; j++) + { + } + } + } + } +} + +void +f3 (void) +{ + #pragma omp for collapse (2) + for (i = 0; i < 5; i++) + { + int k = foo (); /* { dg-error "not enough perfectly nested" } */ + { + { + for (j = 0; j < 5; j++) + { + } + } + } + } +} + +void +f4 (void) +{ + #pragma omp for collapse (2) + for (i = 0; i < 5; i++) + { + { + for (j = 0; j < 5; j++) + ; + foo (); /* { dg-error "collapsed loops not perfectly nested before" } */ + } + } +} + +void +f5 (void) +{ + #pragma omp for collapse (2) + for (i = 0; i < 5; i++) + { + { + for (j = 0; j < 5; j++) + ; + } + foo (); /* { dg-error "collapsed loops not perfectly nested before" } */ + } +} + +void +f6 (void) +{ + #pragma omp for collapse (2) + for (i = 0; i < 5; i++) + { + { + for (j = 0; j < 5; j++) + ; + } + } + foo (); +} |