OpenMP, Fortran: Bugfix for omp_set_num_teams.
authorMarcel Vollweiler <marcel@codesourcery.com>
Wed, 16 Mar 2022 14:38:54 +0000 (07:38 -0700)
committerMarcel Vollweiler <marcel@codesourcery.com>
Wed, 16 Mar 2022 14:38:54 +0000 (07:38 -0700)
This patch fixes a small bug in the omp_set_num_teams implementation.

libgomp/ChangeLog:

* fortran.c (omp_set_num_teams_8_): Call omp_set_num_teams instead of
omp_set_max_active_levels.
* testsuite/libgomp.fortran/icv-8.f90: New test.

libgomp/fortran.c
libgomp/testsuite/libgomp.fortran/icv-8.f90 [new file with mode: 0644]

index 8c1cfd1..d984ce5 100644 (file)
@@ -491,7 +491,7 @@ omp_set_num_teams_ (const int32_t *num_teams)
 void
 omp_set_num_teams_8_ (const int64_t *num_teams)
 {
-  omp_set_max_active_levels (TO_INT (*num_teams));
+  omp_set_num_teams (TO_INT (*num_teams));
 }
 
 int32_t
diff --git a/libgomp/testsuite/libgomp.fortran/icv-8.f90 b/libgomp/testsuite/libgomp.fortran/icv-8.f90
new file mode 100644 (file)
index 0000000..9478c15
--- /dev/null
@@ -0,0 +1,10 @@
+! This tests 'set_num_teams_8' function.
+
+program set_num_teams_8
+  use omp_lib
+  use, intrinsic :: iso_fortran_env
+  integer(int64) :: x
+  x = 42
+  call omp_set_num_teams (x)
+  if (omp_get_max_teams () .ne. 42) stop 1
+end program