source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB040-truedepsingleelement-var-yes.f95

main
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.5 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!Data race pair: a[i]@49:9 vs. a[0]@49:16
9
10
11program DRB040_truedepsingleelement_var_yes
12 use omp_lib
13 implicit none
14
15 integer :: len, i, argCount, allocStatus, rdErr, ix
16 character(len=80), dimension(:), allocatable :: args
17 integer, dimension(:), allocatable :: a
18
19 len = 1000
20
21 argCount = command_argument_count()
22 if (argCount == 0) then
23 write (*,'(a)') "No command line arguments provided."
24 end if
25
26 allocate(args(argCount), stat=allocStatus)
27 if (allocStatus > 0) then
28 write (*,'(a)') "Allocation error, program terminated."
29 stop
30 end if
31
32 do ix = 1, argCount
33 call get_command_argument(ix,args(ix))
34 end do
35
36 if (argCount >= 1) then
37 read (args(1), '(i10)', iostat=rdErr) len
38 if (rdErr /= 0 ) then
39 write (*,'(a)') "Error, invalid integer value."
40 end if
41 end if
42
43 allocate (a(len))
44
45 a(1) = 2
46
47 !$omp parallel do
48 do i = 1, len
49 a(i) = a(i)+a(1)
50 end do
51 !$omp end parallel do
52
53 print 100, a(0)
54 100 format ('a(0) =',i3)
55
56 deallocate(args,a)
57end program
Note: See TracBrowser for help on using the repository browser.