title: Variable locality in OpenMP Reduction with Fortran
body: <p>This is a part of my Fortran code.</p>
  
  <pre><code>iabcd=0
  !$OMP PARALLEL DEFAULT(PRIVATE) SHARED(icheck,iv,HO,tnljm,H)
  !$OMP DO SCHEDULE(DYNAMIC) REDUCTION(+: iabcd)
  do ia=1,HO%NLEV 
    do ib=ia+1,HO%NLEV
      do ic=1,HO%NLEV
        do id=ic+1,HO%NLEV
          if(tnljm%t(ia)+tnljm%t(ib) .ne. tnljm%t(ic)+tnljm%t(id)) cycle 
          iabcd = iabcd + 1
          H%ka(iabcd) = ia
          H%kb(iabcd) = ib
          H%kc(iabcd) = ic
          H%kd(iabcd) = id
          H%ME2BM(iabcd) = 0.d0
        enddo
      enddo
    enddo
  enddo
  !$OMP END DO
  !$OMP END PARALLEL
  </code></pre>
  
  <p>I can run the code without any warning. But, the results are weird and different from the results by not using the OpenMP. What's the problem with the code? Thanks.</p>