+++ /dev/null
-#include <omp.h>
-
-void
-example_criticial ()
-{
- int a, b;
- #pragma omp parallel for
- for (int i = 0; i < 10; ++i)
- {
- #pragma omp critical hint(omp_sync_hint_none) /* OK */
- a += i;
- #pragma omp critical (HASH) hint(omp_sync_hint_none) /* OK */
- a += i;
- #pragma omp critical (HASH2) hint(omp_sync_hint_uncontended) /* OK */
- a += i;
- #pragma omp critical (HASH3) hint(omp_sync_hint_contended) /* OK */
- a += i;
- #pragma omp critical (HASH4) hint(omp_sync_hint_speculative) /* OK */
- a += i;
- #pragma omp critical (HASH5) hint(omp_sync_hint_nonspeculative) /* OK */
- a += i;
- #pragma omp critical (HASH6) hint(omp_sync_hint_contended + omp_sync_hint_speculative) /* OK */
- a += i;
- #pragma omp critical (HASH6) hint(omp_sync_hint_contended | omp_sync_hint_speculative) /* OK */
- a += i;
-
- /* Accepted but invalid: different hint for same name. */
- #pragma omp critical (HASH6) hint(omp_sync_hint_uncontended + omp_sync_hint_speculative)
- a += i;
- /* Accepted but invalid: Some random integer expr. */
- #pragma omp critical (HASH) hint(omp_sync_hint_speculative + 1 + 2)
- a += i;
-
- #pragma omp critical (HASH) hint(-3) /* { dg-error "expected constant integer expression" } */
- a += i;
- #pragma omp critical (HASH2) hint(b) /* { dg-error "constant integer expression" } */
- a += i;
-/*
- Fails with gcc as 'expected identifier' and
- with g++ as "clause requires a name, except when 'omp_sync_hint_none'"
- #pragma omp critical () hint(omp_sync_hint_speculative)
- a += i;
-*/
- #pragma omp critical hint(omp_sync_hint_speculative) /* { dg-error "with 'hint' clause requires a name, except when 'omp_sync_hint_none' is used" } */
- a += i;
- }
-}
+++ /dev/null
-/* { dg-additional-options "-fdump-tree-original" } */
-#include <omp.h>
-
-void
-example_criticial ()
-{
- int a, b;
- #pragma omp parallel for
- for (int i = 0; i < 10; ++i)
- {
- #pragma omp critical hint(omp_sync_hint_none)
- a += i;
- #pragma omp critical (HASH1) hint(omp_sync_hint_none)
- a += i;
- #pragma omp critical (HASH2) hint(omp_sync_hint_uncontended)
- a += i;
- #pragma omp critical (HASH3) hint(omp_sync_hint_contended)
- a += i;
- #pragma omp critical (HASH4) hint(omp_sync_hint_speculative)
- a += i;
- #pragma omp critical (HASH5) hint(omp_sync_hint_nonspeculative)
- a += i;
- #pragma omp critical (HASH6) hint(omp_sync_hint_contended + omp_sync_hint_speculative)
- a += i;
- #pragma omp critical (HASH7) hint(omp_sync_hint_contended | omp_sync_hint_speculative)
- a += i;
- }
-}
-
-/* { dg-final { scan-tree-dump-times "omp critical \\(HASH1\\) hint\\(0\\)" 1 "original" } } */
-/* { dg-final { scan-tree-dump-times "omp critical \\(HASH2\\) hint\\(1\\)" 1 "original" } } */
-/* { dg-final { scan-tree-dump-times "omp critical \\(HASH3\\) hint\\(2\\)" 1 "original" } } */
-/* { dg-final { scan-tree-dump-times "omp critical \\(HASH4\\) hint\\(8\\)" 1 "original" } } */
-/* { dg-final { scan-tree-dump-times "omp critical \\(HASH5\\) hint\\(4\\)" 1 "original" } } */
-/* { dg-final { scan-tree-dump-times "omp critical \\(HASH6\\) hint\\(10\\)" 1 "original" } } */
-/* { dg-final { scan-tree-dump-times "omp critical \\(HASH7\\) hint\\(10\\)" 1 "original" } } */
+++ /dev/null
-subroutine example_criticial ()
- use omp_lib
- implicit none
- integer, parameter :: my_omp_hint = omp_sync_hint_contended
- integer i, a, b
-
- !$omp parallel do
- do i = 1, 10
- !$omp critical (HASH0) hint(my_omp_hint) ! OK
- a = a + i;
- !$omp end critical (HASH0)
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical (HASH1) hint(omp_sync_hint_none) ! OK
- a = a + i;
- !$omp end critical (HASH1)
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical (HASH2) hint(omp_sync_hint_uncontended) ! OK
- a = a + i;
- !$omp end critical (HASH2)
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical (HASH3) hint(omp_sync_hint_contended) ! OK
- a = a + i;
- !$omp end critical (HASH3)
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical (HASH4) hint(omp_sync_hint_speculative) ! OK
- a = a + i;
- !$omp end critical (HASH4)
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical (HASH5) hint(omp_sync_hint_nonspeculative) ! OK
- a = a + i;
- !$omp end critical (HASH5)
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical (HASH6) hint(omp_sync_hint_contended + omp_sync_hint_speculative) ! OK
- a = a + i;
- !$omp end critical (HASH6)
- end do
-
- !$omp parallel do
- do i = 1, 10
- ! Accepted but invalid: different hint for same name.
- !$omp critical (HASH6) hint(omp_sync_hint_contended + omp_sync_hint_speculative) ! OK
- a = a + i;
- !$omp end critical (HASH6)
- end do
- !$omp parallel do
- do i = 1, 10
- ! Accepted but invalid: Some random integer expr.
- !$omp critical (HASH) hint(1 + 2)
- a = a + i;
- !$omp end critical (HASH)
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical (HASH) hint(-3) ! { dg-error "shall be a valid constant hint expression" }
- a = a + i;
- !$omp end critical (HASH)
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical (HASH2) hint(b) ! { dg-error "shall be a valid constant hint expression" }
- a = a + i;
- !$omp end critical (HASH2)
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical () hint(omp_hint_speculative) ! { dg-error "Invalid character in name" }
- a = a + i;
-! !$omp end critical
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical hint(omp_sync_hint_none) ! OK
- a = a + i;
- !$omp end critical
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical hint(omp_sync_hint_contended) ! { dg-error "CRITICAL at .1. with HINT clause requires a NAME, except when omp_sync_hint_none is used" }
- a = a + i;
- !$omp end critical
- end do
-end
+++ /dev/null
-! { dg-additional-options "-fdump-tree-original" }
-subroutine example_criticial ()
- use omp_lib
- implicit none
- integer, parameter :: my_omp_hint = omp_sync_hint_contended
- integer i, a, b
-
- !$omp parallel do
- do i = 1, 10
- !$omp critical (HASH0) hint(my_omp_hint)
- a = a + i;
- !$omp end critical (HASH0)
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical (HASH1), hint(omp_sync_hint_none)
- a = a + i;
- !$omp end critical (HASH1)
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical (HASH2) hint(omp_sync_hint_uncontended)
- a = a + i;
- !$omp end critical (HASH2)
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical (HASH3) hint(omp_sync_hint_contended)
- a = a + i;
- !$omp end critical (HASH3)
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical (HASH4) hint(omp_sync_hint_speculative)
- a = a + i;
- !$omp end critical (HASH4)
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical (HASH5) hint(omp_sync_hint_nonspeculative)
- a = a + i;
- !$omp end critical (HASH5)
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical (HASH6), hint(omp_sync_hint_contended + omp_sync_hint_speculative)
- a = a + i;
- !$omp end critical (HASH6)
- end do
- !$omp parallel do
- do i = 1, 10
- !$omp critical hint(omp_sync_hint_none + omp_sync_hint_none)
- a = a + i;
- !$omp end critical
- end do
-end
-
-! { dg-final { scan-tree-dump-times "omp critical \\(hash0\\) hint\\(2\\)" 1 "original" } }
-! { dg-final { scan-tree-dump-times "omp critical \\(hash1\\) hint\\(0\\)" 1 "original" } }
-! { dg-final { scan-tree-dump-times "omp critical \\(hash2\\) hint\\(1\\)" 1 "original" } }
-! { dg-final { scan-tree-dump-times "omp critical \\(hash3\\) hint\\(2\\)" 1 "original" } }
-! { dg-final { scan-tree-dump-times "omp critical \\(hash4\\) hint\\(8\\)" 1 "original" } }
-! { dg-final { scan-tree-dump-times "omp critical \\(hash5\\) hint\\(4\\)" 1 "original" } }
-! { dg-final { scan-tree-dump-times "omp critical \\(hash6\\) hint\\(10\\)" 1 "original" } }
-! { dg-final { scan-tree-dump-times "omp critical hint\\(0\\)" 1 "original" } }
--- /dev/null
+/* { dg-do compile } */
+
+#include <omp.h>
+
+void
+example_criticial ()
+{
+ int a, b;
+ #pragma omp parallel for
+ for (int i = 0; i < 10; ++i)
+ {
+ #pragma omp critical hint(omp_sync_hint_none) /* OK */
+ a += i;
+ #pragma omp critical (HASH) hint(omp_sync_hint_none) /* OK */
+ a += i;
+ #pragma omp critical (HASH2) hint(omp_sync_hint_uncontended) /* OK */
+ a += i;
+ #pragma omp critical (HASH3) hint(omp_sync_hint_contended) /* OK */
+ a += i;
+ #pragma omp critical (HASH4) hint(omp_sync_hint_speculative) /* OK */
+ a += i;
+ #pragma omp critical (HASH5) hint(omp_sync_hint_nonspeculative) /* OK */
+ a += i;
+ #pragma omp critical (HASH6) hint(omp_sync_hint_contended + omp_sync_hint_speculative) /* OK */
+ a += i;
+ #pragma omp critical (HASH6) hint(omp_sync_hint_contended | omp_sync_hint_speculative) /* OK */
+ a += i;
+
+ /* Accepted but invalid: different hint for same name. */
+ #pragma omp critical (HASH6) hint(omp_sync_hint_uncontended + omp_sync_hint_speculative)
+ a += i;
+ /* Accepted but invalid: Some random integer expr. */
+ #pragma omp critical (HASH) hint(omp_sync_hint_speculative + 1 + 2)
+ a += i;
+
+ #pragma omp critical (HASH) hint(-3) /* { dg-error "expected constant integer expression" } */
+ a += i;
+ #pragma omp critical (HASH2) hint(b) /* { dg-error "constant integer expression" } */
+ a += i;
+/*
+ Fails with gcc as 'expected identifier' and
+ with g++ as "clause requires a name, except when 'omp_sync_hint_none'"
+ #pragma omp critical () hint(omp_sync_hint_speculative)
+ a += i;
+*/
+ #pragma omp critical hint(omp_sync_hint_speculative) /* { dg-error "with 'hint' clause requires a name, except when 'omp_sync_hint_none' is used" } */
+ a += i;
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-original" } */
+#include <omp.h>
+
+void
+example_criticial ()
+{
+ int a, b;
+ #pragma omp parallel for
+ for (int i = 0; i < 10; ++i)
+ {
+ #pragma omp critical hint(omp_sync_hint_none)
+ a += i;
+ #pragma omp critical (HASH1) hint(omp_sync_hint_none)
+ a += i;
+ #pragma omp critical (HASH2) hint(omp_sync_hint_uncontended)
+ a += i;
+ #pragma omp critical (HASH3) hint(omp_sync_hint_contended)
+ a += i;
+ #pragma omp critical (HASH4) hint(omp_sync_hint_speculative)
+ a += i;
+ #pragma omp critical (HASH5) hint(omp_sync_hint_nonspeculative)
+ a += i;
+ #pragma omp critical (HASH6) hint(omp_sync_hint_contended + omp_sync_hint_speculative)
+ a += i;
+ #pragma omp critical (HASH7) hint(omp_sync_hint_contended | omp_sync_hint_speculative)
+ a += i;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "omp critical \\(HASH1\\) hint\\(0\\)" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "omp critical \\(HASH2\\) hint\\(1\\)" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "omp critical \\(HASH3\\) hint\\(2\\)" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "omp critical \\(HASH4\\) hint\\(8\\)" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "omp critical \\(HASH5\\) hint\\(4\\)" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "omp critical \\(HASH6\\) hint\\(10\\)" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "omp critical \\(HASH7\\) hint\\(10\\)" 1 "original" } } */
--- /dev/null
+! { dg-do compile }
+
+subroutine example_criticial ()
+ use omp_lib
+ implicit none
+ integer, parameter :: my_omp_hint = omp_sync_hint_contended
+ integer i, a, b
+
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical (HASH0) hint(my_omp_hint) ! OK
+ a = a + i;
+ !$omp end critical (HASH0)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical (HASH1) hint(omp_sync_hint_none) ! OK
+ a = a + i;
+ !$omp end critical (HASH1)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical (HASH2) hint(omp_sync_hint_uncontended) ! OK
+ a = a + i;
+ !$omp end critical (HASH2)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical (HASH3) hint(omp_sync_hint_contended) ! OK
+ a = a + i;
+ !$omp end critical (HASH3)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical (HASH4) hint(omp_sync_hint_speculative) ! OK
+ a = a + i;
+ !$omp end critical (HASH4)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical (HASH5) hint(omp_sync_hint_nonspeculative) ! OK
+ a = a + i;
+ !$omp end critical (HASH5)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical (HASH6) hint(omp_sync_hint_contended + omp_sync_hint_speculative) ! OK
+ a = a + i;
+ !$omp end critical (HASH6)
+ end do
+
+ !$omp parallel do
+ do i = 1, 10
+ ! Accepted but invalid: different hint for same name.
+ !$omp critical (HASH6) hint(omp_sync_hint_contended + omp_sync_hint_speculative) ! OK
+ a = a + i;
+ !$omp end critical (HASH6)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ ! Accepted but invalid: Some random integer expr.
+ !$omp critical (HASH) hint(1 + 2)
+ a = a + i;
+ !$omp end critical (HASH)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical (HASH) hint(-3) ! { dg-error "shall be a valid constant hint expression" }
+ a = a + i;
+ !$omp end critical (HASH)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical (HASH2) hint(b) ! { dg-error "shall be a valid constant hint expression" }
+ a = a + i;
+ !$omp end critical (HASH2)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical () hint(omp_hint_speculative) ! { dg-error "Invalid character in name" }
+ a = a + i;
+! !$omp end critical
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical hint(omp_sync_hint_none) ! OK
+ a = a + i;
+ !$omp end critical
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical hint(omp_sync_hint_contended) ! { dg-error "CRITICAL at .1. with HINT clause requires a NAME, except when omp_sync_hint_none is used" }
+ a = a + i;
+ !$omp end critical
+ end do
+end
--- /dev/null
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-original" }
+subroutine example_criticial ()
+ use omp_lib
+ implicit none
+ integer, parameter :: my_omp_hint = omp_sync_hint_contended
+ integer i, a, b
+
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical (HASH0) hint(my_omp_hint)
+ a = a + i;
+ !$omp end critical (HASH0)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical (HASH1), hint(omp_sync_hint_none)
+ a = a + i;
+ !$omp end critical (HASH1)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical (HASH2) hint(omp_sync_hint_uncontended)
+ a = a + i;
+ !$omp end critical (HASH2)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical (HASH3) hint(omp_sync_hint_contended)
+ a = a + i;
+ !$omp end critical (HASH3)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical (HASH4) hint(omp_sync_hint_speculative)
+ a = a + i;
+ !$omp end critical (HASH4)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical (HASH5) hint(omp_sync_hint_nonspeculative)
+ a = a + i;
+ !$omp end critical (HASH5)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical (HASH6), hint(omp_sync_hint_contended + omp_sync_hint_speculative)
+ a = a + i;
+ !$omp end critical (HASH6)
+ end do
+ !$omp parallel do
+ do i = 1, 10
+ !$omp critical hint(omp_sync_hint_none + omp_sync_hint_none)
+ a = a + i;
+ !$omp end critical
+ end do
+end
+
+! { dg-final { scan-tree-dump-times "omp critical \\(hash0\\) hint\\(2\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "omp critical \\(hash1\\) hint\\(0\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "omp critical \\(hash2\\) hint\\(1\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "omp critical \\(hash3\\) hint\\(2\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "omp critical \\(hash4\\) hint\\(8\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "omp critical \\(hash5\\) hint\\(4\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "omp critical \\(hash6\\) hint\\(10\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "omp critical hint\\(0\\)" 1 "original" } }