program pp_omp_ex7 !Example of a race condition !$ use omp_lib implicit none integer :: i,n,a n=1000000 a=0 !$omp parallel shared(a,n) private(i) !$omp do do i=1,n !When one thread writes to a, the value of a !it had read might not be current anymore a=a+i enddo !$omp end do !$omp end parallel !Show what was produced write(6,*) 'a=',a end program pp_omp_ex7