summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gomp/barrier-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/gomp/barrier-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/gomp/barrier-2.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/gomp/barrier-2.c b/gcc/testsuite/gcc.dg/gomp/barrier-2.c
new file mode 100644
index 000000000..3787c35a1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/barrier-2.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+
+void f1(void)
+{
+ #pragma omp barrier a /* { dg-error "expected end of line" } */
+}
+
+/* OpenMP 2.5, section 2.7.3:
+
+ Note that because the barrier construct does not have a C language
+ statement as part of its syntax, there are some restrictions on its
+ placement within a program. The barrier directive may only be placed
+ in the program at a position where ignoring or deleting the directive
+ would result in a program with correct syntax. */
+
+void f2(void)
+{
+ label: /* { dg-error "label at end of compound statement" } */
+ #pragma omp barrier
+}
+
+void f3(_Bool p)
+{
+ if (p)
+ #pragma omp barrier /* { dg-error "compound statements" } */
+}