cpp: #include <stdio.h>\n#include <stdlib.h>\n#include <omp.h>\n#define C 64\n\nfloat a;\nfloat x[C];\nfloat y[C];\n\nint main(){\n  for(int i=0; i<C; i++){\n    a=5;\n    x[i]=0;\n    y[i]=3;\n  }\n\n  #pragma omp target map(to:y[0:C],a) map(tofrom:x[0:C]) device(0)\n  {\n    for(int i=0; i<C; i++){\n      #pragma omp task depend(inout:x[i])\n      {\n        x[i] = a * x[i];\n      }\n      #pragma omp task depend(inout:x[i])\n      {\n        x[i] = x[i] + y[i];\n      }\n    }\n  }\n\n  for(int i=0; i<C; i++){\n    if(x[i]!=3){\n      printf("Data Race Detected\n");\n      return 0;\n    }\n  }\n\n  #pragma omp taskwait\n  return 0;\n}\n
fortran: program DRB158_missingtaskbarrier_orig_gpu_no\n    use omp_lib\n    use DRB158\n    implicit none\n\n    do i = 1, 64\n        x(i) = 0\n        y(i) = 3\n    end do\n\n    a = 5\n\n    !$omp target map(to:y,a) map(tofrom:x) device(0)\n    do i = 1, 64\n        !$omp task depend(inout:x(i))\n        x(i) = a*x(i)\n        !$omp end task\n\n        !$omp task depend(inout:x(i))\n        x(i) = x(i)+y(i)\n        !$omp end task\n    end do\n    !$omp end target\n\n    do i = 1, 64\n        if (x(i) /= 3) then\n            print*,x(i)\n        end if\n    end do\n\n    !$omp taskwait\n\nend program