[Openmp-commits] [openmp] [openmp][tests] Fix bug63197.c (PR #183508)

via Openmp-commits openmp-commits at lists.llvm.org
Thu Feb 26 04:22:54 PST 2026


https://github.com/jprotze updated https://github.com/llvm/llvm-project/pull/183508

>From 524389ad0f71d56023b4518bbfa60006bfee9fae Mon Sep 17 00:00:00 2001
From: Joachim Jenke <jenke at itc.rwth-aachen.de>
Date: Thu, 26 Feb 2026 13:06:19 +0100
Subject: [PATCH] Fix the test so that it can only fail if the bug is present

---
 openmp/runtime/test/parallel/bug63197.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/openmp/runtime/test/parallel/bug63197.c b/openmp/runtime/test/parallel/bug63197.c
index 734f5c89c0a2d..de9226d7d1366 100644
--- a/openmp/runtime/test/parallel/bug63197.c
+++ b/openmp/runtime/test/parallel/bug63197.c
@@ -3,16 +3,22 @@
 #include <omp.h>
 #include <stdio.h>
 
+/* This code tests that state pushed for the num_threads clause does not 
+   reach the next parallel region. omp_get_max_threads() + 1 can never
+   be chosen as team size for the second parallel and could only be the
+   result of some left-over state from the first parallel.
+ */
+
 int main(int argc, char *argv[]) {
-  unsigned N = omp_get_max_threads() - 1;
-#pragma omp parallel num_threads(N) if (0)
+  unsigned N = omp_get_max_threads();
+#pragma omp parallel num_threads(N+1) if (0)
 #pragma omp single
   { printf("BBB %2d\n", omp_get_num_threads()); }
 
 #pragma omp parallel
 #pragma omp single
   {
-    if (omp_get_num_threads() != N)
+    if (omp_get_num_threads() <= N)
       printf("PASS\n");
   }
   return 0;



More information about the Openmp-commits mailing list