gcc/libgomp/testsuite/libgomp.fortran/critical-hint-1.f90
Tobias Burnus ade6e7204c critical-hint-*.{c,f90}: Move from gcc/testsuite to libgomp/testsuite
libgomp/ChangeLog:

	* testsuite/libgomp.c-c++-common/critical-hint-1.c: New; moved from
	gcc/testsuite/c-c++-common/gomp/.
	* testsuite/libgomp.c-c++-common/critical-hint-2.c: Likewise.
	* testsuite/libgomp.fortran/critical-hint-1.f90: New; moved
	from gcc/testsuite/gfortran.dg/gomp/.
	* testsuite/libgomp.fortran/critical-hint-2.f90: Likewise.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/critical-hint-1.c: Moved to libgomp/.
	* c-c++-common/gomp/critical-hint-2.c: Moved to libgomp/.
	* gfortran.dg/gomp/critical-hint-1.f90: Moved to libgomp/.
	* gfortran.dg/gomp/critical-hint-2.f90: Moved to libgomp/.
2020-07-22 12:14:22 +02:00

97 lines
2.6 KiB
Fortran

! { 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