| 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 |
|
|---|
| 12 | program 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)
|
|---|
| 50 | end program
|
|---|