| [e3f356c] | 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 outer loop has a loop-carried true dependence.
|
|---|
| 9 | !Data race pair: b[i][j]@56:13 vs. b[i-1][j-1]@56:22
|
|---|
| 10 |
|
|---|
| 11 | program DRB032_truedepfirstdimension_var_yes
|
|---|
| 12 | use omp_lib
|
|---|
| 13 | implicit none
|
|---|
| 14 |
|
|---|
| 15 | integer :: i, j, n, m, len, argCount, allocStatus, rdErr, ix
|
|---|
| 16 | character(len=80), dimension(:), allocatable :: args
|
|---|
| 17 | real, dimension(:,:), allocatable :: b
|
|---|
| 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 | n = len
|
|---|
| 44 | m = len
|
|---|
| 45 | allocate (b(n,m))
|
|---|
| 46 |
|
|---|
| 47 | do i = 1, n
|
|---|
| 48 | do j = 1, m
|
|---|
| 49 | b(i,j) = 0.5
|
|---|
| 50 | end do
|
|---|
| 51 | end do
|
|---|
| 52 |
|
|---|
| 53 | !$omp parallel do private(j)
|
|---|
| 54 | do i = 2, n
|
|---|
| 55 | do j = 2, m
|
|---|
| 56 | b(i,j) = b(i-1, j-1)
|
|---|
| 57 | end do
|
|---|
| 58 | end do
|
|---|
| 59 | !$omp end parallel do
|
|---|
| 60 |
|
|---|
| 61 | print 100, b(500,500)
|
|---|
| 62 | 100 format ('b(500,500) =',F10.6)
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 | deallocate(args,b)
|
|---|
| 66 | end program
|
|---|