source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB011-minusminus-orig-yes.f95

1.23 v1.23.0
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100755
File size: 1.0 KB
Line 
1!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!
2!!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC
3!!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file for details.
4!!!
5!!! SPDX-License-Identifier: (BSD-3-Clause)
6!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!
7
8!The -1 operation on numNodes2 is not protected, causing data race.
9!Data race pair: numNodes2@32:13 vs. numNodes2@32:13
10
11program DRB011_minusminus_orig_yes
12 use omp_lib
13 implicit none
14
15 integer :: i, len, numNodes, numNodes2
16 integer :: x(100)
17 len = 100
18 numNodes=len
19 numNodes2=0
20
21 do i = 1, len
22 if (MOD(i,2) == 0) then
23 x(i) = 5
24 else
25 x(i) = -5
26 end if
27 end do
28
29 !$omp parallel do
30 do i = numNodes, 1, -1
31 if (x(i) <= 0) then
32 numNodes2 = numNodes2-1
33 end if
34 end do
35 !$omp end parallel do
36
37 print*,"numNodes2 =", numNodes2
38end program
Note: See TracBrowser for help on using the repository browser.