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