summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openmp/runtime/src/kmp_gsupport.c2
-rw-r--r--openmp/runtime/test/tasking/bug_serial_taskgroup.c16
2 files changed, 17 insertions, 1 deletions
diff --git a/openmp/runtime/src/kmp_gsupport.c b/openmp/runtime/src/kmp_gsupport.c
index 23c97d19bc7..62baa2b24cf 100644
--- a/openmp/runtime/src/kmp_gsupport.c
+++ b/openmp/runtime/src/kmp_gsupport.c
@@ -1259,7 +1259,7 @@ PARALLEL_LOOP(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME), kmp_sch_runtime)
void
xexpand(KMP_API_NAME_GOMP_TASKGROUP_START)(void)
{
- int gtid = __kmp_get_gtid();
+ int gtid = __kmp_entry_gtid();
MKLOC(loc, "GOMP_taskgroup_start");
KA_TRACE(20, ("GOMP_taskgroup_start: T#%d\n", gtid));
diff --git a/openmp/runtime/test/tasking/bug_serial_taskgroup.c b/openmp/runtime/test/tasking/bug_serial_taskgroup.c
new file mode 100644
index 00000000000..850bc907553
--- /dev/null
+++ b/openmp/runtime/test/tasking/bug_serial_taskgroup.c
@@ -0,0 +1,16 @@
+// RUN: %libomp-compile-and-run
+
+/*
+ GCC failed this test because __kmp_get_gtid() instead of __kmp_entry_gtid()
+ was called in xexpand(KMP_API_NAME_GOMP_TASKGROUP_START)(void).
+ __kmp_entry_gtid() will initialize the runtime if not yet done which does not
+ happen with __kmp_get_gtid().
+ */
+
+int main()
+{
+ #pragma omp taskgroup
+ { }
+
+ return 0;
+}
OpenPOWER on IntegriCloud