diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-06 20:39:46 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-06 20:39:46 +0000 |
commit | e97da9acca05b56be99bfd9abd8b83e5db5268fb (patch) | |
tree | fcab715a6c79d738a81d753254714e02889ad105 /libgomp/testsuite/libgomp.c/lock-1.c | |
parent | 76d6e5e429f5ca1ba89341e4fd3cbd5f4a6f055f (diff) | |
download | gcc-e97da9acca05b56be99bfd9abd8b83e5db5268fb.tar.gz |
2008-06-06 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r136492
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@136504 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/testsuite/libgomp.c/lock-1.c')
-rw-r--r-- | libgomp/testsuite/libgomp.c/lock-1.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c/lock-1.c b/libgomp/testsuite/libgomp.c/lock-1.c new file mode 100644 index 00000000000..e09645dbc3f --- /dev/null +++ b/libgomp/testsuite/libgomp.c/lock-1.c @@ -0,0 +1,31 @@ +#include <omp.h> +#include <stdlib.h> + +int +main (void) +{ + int l = 0; + omp_nest_lock_t lock; + omp_init_nest_lock (&lock); + if (omp_test_nest_lock (&lock) != 1) + abort (); + if (omp_test_nest_lock (&lock) != 2) + abort (); +#pragma omp parallel if (0) reduction (+:l) + { + /* In OpenMP 2.5 this was supposed to return 3, + but in OpenMP 3.0 the parallel region has a different + task and omp_*_lock_t are owned by tasks, not by threads. */ + if (omp_test_nest_lock (&lock) != 0) + l++; + } + if (l) + abort (); + if (omp_test_nest_lock (&lock) != 3) + abort (); + omp_unset_nest_lock (&lock); + omp_unset_nest_lock (&lock); + omp_unset_nest_lock (&lock); + omp_destroy_nest_lock (&lock); + return 0; +} |