gcc/libgomp/testsuite/libgomp.fortran/lib2.f
Kwok Cheung Yeung 10508db867 openmp: Mark deprecated symbols in OpenMP 5.0
2020-11-05  Ulrich Drepper  <drepper@redhat.com>
	    Kwok Cheung Yeung  <kcy@codesourcery.com>

	libgomp/
	* Makefile.am (%.mod): Add -cpp and -fopenmp to compile flags.
	* Makefile.in: Regenerate.
	* fortran.c: Wrap uses of omp_set_nested and omp_get_nested with
	pragmas to ignore -Wdeprecated-declarations warnings.
	* icv.c: Likewise.
	* omp.h.in (__GOMP_DEPRECATED_5_0): Define.
	Mark omp_lock_hint_* enum values, omp_lock_hint_t, omp_set_nested,
	and omp_get_nested with __GOMP_DEPRECATED_5_0.
	* omp_lib.f90.in: Mark omp_get_nested and omp_set_nested as
	deprecated.
	* testsuite/libgomp.c++/affinity-1.C: Add -Wno-deprecated-declarations
	to test options.
	* testsuite/libgomp.c/affinity-1.c: Likewise.
	* testsuite/libgomp.c/affinity-2.c: Likewise.
	* testsuite/libgomp.c/appendix-a/a.15.1.c: Likewise.
	* testsuite/libgomp.c/lib-1.c: Likewise.
	* testsuite/libgomp.c/nested-1.c: Likewise.
	* testsuite/libgomp.c/nested-2.c: Likewise.
	* testsuite/libgomp.c/nested-3.c: Likewise.
	* testsuite/libgomp.c/pr32362-1.c: Likewise.
	* testsuite/libgomp.c/pr32362-2.c: Likewise.
	* testsuite/libgomp.c/pr32362-3.c: Likewise.
	* testsuite/libgomp.c/pr35549.c: Likewise.
	* testsuite/libgomp.c/pr42942.c: Likewise.
	* testsuite/libgomp.c/pr61200.c: Likewise.
	* testsuite/libgomp.c/sort-1.c: Likewise.
	* testsuite/libgomp.c/target-5.c: Likewise.
	* testsuite/libgomp.c/target-6.c: Likewise.
	* testsuite/libgomp.c/teams-1.c: Likewise.
	* testsuite/libgomp.c/thread-limit-1.c: Likewise.
	* testsuite/libgomp.c/thread-limit-2.c: Likewise.
	* testsuite/libgomp.c/thread-limit-4.c: Likewise.
	* testsuite/libgomp.fortran/affinity1.f90: Likewise.
	* testsuite/libgomp.fortran/lib1.f90: Likewise.
	* testsuite/libgomp.fortran/lib2.f: Likewise.
	* testsuite/libgomp.fortran/nested1.f90: Likewise.
	* testsuite/libgomp.fortran/teams1.f90: Likewise.
2020-11-05 10:32:56 -08:00

79 lines
2.4 KiB
Fortran

C { dg-do run }
C { dg-additional-options "-Wno-deprecated-declarations" }
USE OMP_LIB
DOUBLE PRECISION :: D, E
LOGICAL :: L
INTEGER (KIND = OMP_LOCK_KIND) :: LCK
INTEGER (KIND = OMP_NEST_LOCK_KIND) :: NLCK
D = OMP_GET_WTIME ()
CALL OMP_INIT_LOCK (LCK)
CALL OMP_SET_LOCK (LCK)
IF (OMP_TEST_LOCK (LCK)) STOP 1
CALL OMP_UNSET_LOCK (LCK)
IF (.NOT. OMP_TEST_LOCK (LCK)) STOP 2
IF (OMP_TEST_LOCK (LCK)) STOP 3
CALL OMP_UNSET_LOCK (LCK)
CALL OMP_DESTROY_LOCK (LCK)
CALL OMP_INIT_NEST_LOCK (NLCK)
IF (OMP_TEST_NEST_LOCK (NLCK) .NE. 1) STOP 4
CALL OMP_SET_NEST_LOCK (NLCK)
IF (OMP_TEST_NEST_LOCK (NLCK) .NE. 3) STOP 5
CALL OMP_UNSET_NEST_LOCK (NLCK)
CALL OMP_UNSET_NEST_LOCK (NLCK)
IF (OMP_TEST_NEST_LOCK (NLCK) .NE. 2) STOP 6
CALL OMP_UNSET_NEST_LOCK (NLCK)
CALL OMP_UNSET_NEST_LOCK (NLCK)
CALL OMP_DESTROY_NEST_LOCK (NLCK)
CALL OMP_SET_DYNAMIC (.TRUE.)
IF (.NOT. OMP_GET_DYNAMIC ()) STOP 7
CALL OMP_SET_DYNAMIC (.FALSE.)
IF (OMP_GET_DYNAMIC ()) STOP 8
CALL OMP_SET_NESTED (.TRUE.)
IF (.NOT. OMP_GET_NESTED ()) STOP 9
CALL OMP_SET_NESTED (.FALSE.)
IF (OMP_GET_NESTED ()) STOP 10
CALL OMP_SET_NUM_THREADS (5)
IF (OMP_GET_NUM_THREADS () .NE. 1) STOP 11
IF (OMP_GET_MAX_THREADS () .NE. 5) STOP 12
IF (OMP_GET_THREAD_NUM () .NE. 0) STOP 13
CALL OMP_SET_NUM_THREADS (3)
IF (OMP_GET_NUM_THREADS () .NE. 1) STOP 14
IF (OMP_GET_MAX_THREADS () .NE. 3) STOP 15
IF (OMP_GET_THREAD_NUM () .NE. 0) STOP 16
L = .FALSE.
C$OMP PARALLEL REDUCTION (.OR.:L)
L = OMP_GET_NUM_THREADS () .NE. 3
L = L .OR. (OMP_GET_THREAD_NUM () .LT. 0)
L = L .OR. (OMP_GET_THREAD_NUM () .GE. 3)
C$OMP MASTER
L = L .OR. (OMP_GET_THREAD_NUM () .NE. 0)
C$OMP END MASTER
C$OMP END PARALLEL
IF (L) STOP 17
IF (OMP_GET_NUM_PROCS () .LE. 0) STOP 18
IF (OMP_IN_PARALLEL ()) STOP 19
C$OMP PARALLEL REDUCTION (.OR.:L)
L = .NOT. OMP_IN_PARALLEL ()
C$OMP END PARALLEL
C$OMP PARALLEL REDUCTION (.OR.:L) IF (.TRUE.)
L = .NOT. OMP_IN_PARALLEL ()
C$OMP END PARALLEL
IF (L) STOP 20
E = OMP_GET_WTIME ()
IF (D .GT. E) STOP 21
D = OMP_GET_WTICK ()
C Negative precision is definitely wrong,
C bigger than 1s clock resolution is also strange
IF (D .LE. 0 .OR. D .GT. 1.) STOP 22
END