cpp: #include <stdio.h>\n#include <assert.h>\nint main()\n{\n  int i,error;\n  int len = 1000;\n  int a[len], b=5;\n\n  for (i=0; i<len; i++)\n    a[i]= i;\n \n#pragma omp parallel shared(b, error) \n  {\n#pragma omp for nowait\n    for(i = 0; i < len; i++)\n      a[i] = b + a[i]*5;\n\n#pragma omp barrier\n\n#pragma omp single\n    error = a[9] + 1;\n  }\n  assert (error == 51);\n  printf ("error = %d\n", error);\n  return 0;\n}  \n
fortran: program DRB104_nowait_barrier_orig_no\n    use omp_lib\n    implicit none\n\n    integer i, error, len, b\n    integer, dimension(:), allocatable :: a\n\n    len = 1000\n    b = 5\n    allocate (a(len))\n\n    do i = 1, len\n        a(i) = i\n    end do\n\n    !$omp parallel shared(b, error)\n        !$omp do\n        do i = 1, len\n            a(i) = b+a(i)*5\n        end do\n        !$omp end do nowait\n    !$omp end parallel\n\n    !$omp barrier\n    !$omp single\n    error = a(9)+1\n    !$omp end single\n\n    print 100, error\n    100 format ('error =',3i8)\n\n    deallocate(a)\nend program