diff options
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/c-c++-common/gomp/task-detach-1.c | 37 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/gomp/task-detach-1.C | 29 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/gomp/task-detach-1.c | 20 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/gomp/task-detach-1.f90 | 29 |
4 files changed, 115 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/gomp/task-detach-1.c b/gcc/testsuite/c-c++-common/gomp/task-detach-1.c new file mode 100644 index 00000000000..4558bc1f89c --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/task-detach-1.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +typedef enum omp_event_handle_t +{ + __omp_event_handle_t_max__ = __UINTPTR_MAX__ +} omp_event_handle_t; + +extern void omp_fulfill_event (omp_event_handle_t); + +void f (omp_event_handle_t x, omp_event_handle_t y, int z) +{ + #pragma omp task detach (x) detach (y) /* { dg-error "too many 'detach' clauses on a task construct" } */ + ; + + #pragma omp task mergeable detach (x) /* { dg-error "'detach' clause must not be used together with 'mergeable' clause" } */ + ; + + #pragma omp task detach (x) mergeable /* { dg-error "'detach' clause must not be used together with 'mergeable' clause" } */ + ; + + #pragma omp task detach (z) /* { dg-error "'detach' clause event handle has type 'int' rather than 'omp_event_handle_t'" } */ + ; + + #pragma omp parallel master default (none) /* { dg-message "enclosing 'parallel'" } */ + #pragma omp task detach (x) /* { dg-error "'x' not specified in enclosing 'parallel'" } */ + ; + + #pragma omp task detach (x) default (none) /* This should work. */ + omp_fulfill_event (x); + + #pragma omp task detach (x) firstprivate (x) /* { dg-error "the event handle of a 'detach' clause should not be in a data-sharing clause" } */ + ; + + #pragma omp task detach (x) shared (x) /* { dg-error "the event handle of a 'detach' clause should not be in a data-sharing clause" } */ + ; +} diff --git a/gcc/testsuite/g++.dg/gomp/task-detach-1.C b/gcc/testsuite/g++.dg/gomp/task-detach-1.C new file mode 100644 index 00000000000..6028cb418c7 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/task-detach-1.C @@ -0,0 +1,29 @@ +// { dg-do compile } +// { dg-options "-fopenmp" } + +typedef enum omp_event_handle_t +{ + __omp_event_handle_t_max__ = __UINTPTR_MAX__ +} omp_event_handle_t; + +template <typename T> +void foo () +{ + T t; + #pragma omp task detach (t) + ; +} + +template <typename T> +void bar () +{ + T t; + #pragma omp task detach (t) // { dg-error "'detach' clause event handle has type 'int' rather than 'omp_event_handle_t'" } + ; +} + +void f() +{ + foo <omp_event_handle_t> (); + bar <int> (); // { dg-message "required from here" } +} diff --git a/gcc/testsuite/gcc.dg/gomp/task-detach-1.c b/gcc/testsuite/gcc.dg/gomp/task-detach-1.c new file mode 100644 index 00000000000..611044d8d97 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/task-detach-1.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +typedef enum omp_event_handle_t +{ + __omp_event_handle_t_max__ = __UINTPTR_MAX__ +} omp_event_handle_t; + +extern void omp_fulfill_event (omp_event_handle_t); + +void f (omp_event_handle_t x) +{ + void g (void) + { + #pragma omp task detach (x) + omp_fulfill_event (x); + } + + g (); +} diff --git a/gcc/testsuite/gfortran.dg/gomp/task-detach-1.f90 b/gcc/testsuite/gfortran.dg/gomp/task-detach-1.f90 new file mode 100644 index 00000000000..4763f13ba84 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/task-detach-1.f90 @@ -0,0 +1,29 @@ +! { dg-do compile } +! { dg-options "-fopenmp" } + +program task_detach_1 + use iso_c_binding, only: c_intptr_t + implicit none + + integer, parameter :: omp_event_handle_kind = c_intptr_t + integer (kind=omp_event_handle_kind) :: x, y + integer :: z + + !$omp task detach(x) detach(y) ! { dg-error "Failed to match clause at \\\(1\\\)" } + !$omp end task ! { dg-error "Unexpected !\\\$OMP END TASK statement at \\\(1\\\)" } + + !$omp task mergeable detach(x) ! { dg-error "'DETACH' clause at \\\(1\\\) must not be used together with 'MERGEABLE' clause" } + !$omp end task + + !$omp task detach(x) mergeable ! { dg-error "'DETACH' clause at \\\(1\\\) must not be used together with 'MERGEABLE' clause" } + !$omp end task + + !$omp task detach(z) ! { dg-error "'z' at \\\(1\\\) should be of type integer\\\(kind=omp_event_handle_kind\\\)" } + !$omp end task ! { dg-error "Unexpected !\\\$OMP END TASK statement at \\\(1\\\)" } + + !$omp task detach (x) firstprivate (x) ! { dg-error "DETACH event handle 'x' in FIRSTPRIVATE clause at \\\(1\\\)" } + !$omp end task + + !$omp task detach (x) shared (x) ! { dg-error "DETACH event handle 'x' in SHARED clause at \\\(1\\\)" } + !$omp end task +end program |