source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB010-lastprivatemissing-var-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.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!This loop has loop-carried output-dependence due to x=... at line 44.
9!The problem can be solved by using lastprivate(x) .
10!Data race pair: x@44:9 vs. x@44:9
11
12program DRB010_lastprivatemissing_var_yes
13 use omp_lib
14 implicit none
15
16 integer :: i, len, argCount, allocStatus, rdErr, x, ix
17 character(len=80), dimension(:), allocatable :: args
18 len = 10000
19
20 argCount = command_argument_count()
21 if (argCount == 0) then
22 write (*,'(a)') "No command line arguments provided."
23 end if
24
25 allocate(args(argCount), stat=allocStatus)
26 if (allocStatus > 0) then
27 write (*,'(a)') "Allocation error, program terminated."
28 stop
29 end if
30
31 do ix = 1, argCount
32 call get_command_argument(ix,args(ix))
33 end do
34
35 if (argCount >= 1) then
36 read (args(1), '(i10)', iostat=rdErr) len
37 if (rdErr /= 0 ) then
38 write (*,'(a)') "Error, invalid integer value."
39 end if
40 end if
41
42 !$omp parallel do private(i)
43 do i = 0, len
44 x = i
45 end do
46 !$omp end parallel do
47 write(*,*) 'x =', x
48
49 deallocate(args)
50end program
Note: See TracBrowser for help on using the repository browser.