cpp: #include <omp.h>\n#include <stdio.h>\n\nint main(int argc, char* argv[])\n{\n  int var = 0;\n\n  #pragma omp parallel shared(var)\n  {\n    #pragma omp single\n    var++;\n\n    #pragma omp barrier\n\n    #pragma omp single\n    var++;\n  }\n\n  if(var != 2) printf("%d\n",var);\n  int error = (var != 2);\n  return error;\n}\n
fortran: program DRB120_barrier_orig_no\n    use omp_lib\n    implicit none\n\n    integer :: var\n\n    !$omp parallel shared(var)\n    !$omp single\n    var = var + 1;\n    !$omp end single\n    !$omp barrier\n\n    !$omp single\n    var = var + 1;\n    !$omp end single\n    !$omp end parallel\n\n    print 100, var\n    100 format ('var =',i3)\nend program