Index: runtime/src/kmp_gsupport.c =================================================================== --- runtime/src/kmp_gsupport.c +++ runtime/src/kmp_gsupport.c @@ -1259,7 +1259,7 @@ 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)); Index: runtime/test/tasking/bug_serial_taskgroup.c =================================================================== --- /dev/null +++ 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 of not yet done which does not + happen with __kmp_get_gtid(). + */ + +int main() +{ + #pragma omp taskgroup + { } + + return 0; +}