| 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 | !Array initialization using assignments. No data race pairs.
|
|---|
| 9 |
|
|---|
| 10 | module DRB067
|
|---|
| 11 | use omp_lib
|
|---|
| 12 | implicit none
|
|---|
| 13 | contains
|
|---|
| 14 | subroutine foo(newSxx, newSyy, len)
|
|---|
| 15 | integer, value :: len
|
|---|
| 16 | integer :: i
|
|---|
| 17 | integer, parameter :: dp = kind(1.0d0)
|
|---|
| 18 | real(dp),dimension(:), pointer :: newSxx, newSyy
|
|---|
| 19 | real(dp),dimension(len), target :: tar1, tar2
|
|---|
| 20 |
|
|---|
| 21 | allocate (newSxx(len))
|
|---|
| 22 | allocate (newSyy(len))
|
|---|
| 23 |
|
|---|
| 24 | newSxx => tar1
|
|---|
| 25 | newSyy => tar2
|
|---|
| 26 |
|
|---|
| 27 | !$omp parallel do private (i) firstprivate (len)
|
|---|
| 28 | do i = 1, len
|
|---|
| 29 | tar1(i) = 0.0
|
|---|
| 30 | tar2(i) = 0.0
|
|---|
| 31 | end do
|
|---|
| 32 | !$omp end parallel do
|
|---|
| 33 |
|
|---|
| 34 | print*,tar1(len),tar2(len)
|
|---|
| 35 |
|
|---|
| 36 | if(associated(newSxx))nullify(newSxx)
|
|---|
| 37 | if(associated(newSyy))nullify(newSyy)
|
|---|
| 38 |
|
|---|
| 39 | end subroutine
|
|---|
| 40 | end module
|
|---|
| 41 | program DRB067_restrictpointer1_orig_no
|
|---|
| 42 | use omp_lib
|
|---|
| 43 | use DRB067
|
|---|
| 44 | implicit none
|
|---|
| 45 |
|
|---|
| 46 | integer :: len = 1000
|
|---|
| 47 | integer, parameter :: dp = kind(1.0d0)
|
|---|
| 48 | real(dp),dimension(:), pointer :: newSxx, newSyy
|
|---|
| 49 |
|
|---|
| 50 | allocate (newSxx(len))
|
|---|
| 51 | allocate (newSyy(len))
|
|---|
| 52 |
|
|---|
| 53 | call foo(newSxx, newSyy, len)
|
|---|
| 54 |
|
|---|
| 55 | if(associated(newSxx))nullify(newSxx)
|
|---|
| 56 | if(associated(newSyy))nullify(newSyy)
|
|---|
| 57 | end program
|
|---|