cpp: #include <stdio.h>\n#include <omp.h>\n#define N 100\n\nint main(){\n  omp_lock_t lck;\n  int var=0;\n  omp_init_lock(&lck);\n\n  #pragma omp target map(tofrom:var) device(0)\n  #pragma omp teams num_teams(1)\n  #pragma omp distribute parallel for\n  for (int i=0; i<N; i++){\n    omp_set_lock(&lck);\n    var++;\n    omp_unset_lock(&lck);\n  }\n\n  omp_destroy_lock(&lck);\n  printf("%d\n",var);\n  return 0;\n}\n
fortran: program DRB152_missinglock2_orig_gpu_no\n    use omp_lib\n    implicit none\n\n    integer (kind=omp_lock_kind) :: lck\n    integer :: var, i\n    var = 0\n\n    !$omp target map(tofrom:var) device(0)\n    !$omp teams num_teams(1)\n    !$omp distribute parallel do\n    do i = 1, 100\n        call omp_set_lock(lck)\n        var = var+1\n        call omp_unset_lock(lck)\n    end do\n    !$omp end distribute parallel do\n    !$omp end teams\n    !$omp end target\nend program