cpp: #include <omp.h>\n#include <stdio.h>\n\nint tp;\n#pragma omp threadprivate(tp)\nint var;\n\nint main(){\n  #pragma omp task\n  {\n    #pragma omp task\n    {\n      tp = 1;\n      #pragma omp task\n      {\n      }\n      var = tp;\n    }\n    tp=2;\n  }\n\n  if(var==2) printf("%d\n",var);\n  return 0;\n}\n
fortran: module DRB127\ninteger :: tp, var\n!$omp threadprivate(tp)\ncontains\nsubroutine foo\n!$omp task\n!$omp task\ntp = 1\n!$omp task\n!$omp end task\nvar = tp                ! value of var can be 1 or 2\n!$omp end task\ntp = 2\n!$omp end task\nend subroutine\nend module program DRB127_tasking_threadprivate1_orig_no\n    use omp_lib\n    use DRB127\n    implicit none\n\n    call foo()\n\nend program