/* !!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! !!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC !!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file for details. !!! !!! SPDX-License-Identifier: (BSD-3-Clause) !!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! */ /*This example is referred from DRACC by Adrian Schmitz et al. Vector addition followed by multiplication involving the same var should have a barrier in between. omp distribute directive does not have implicit barrier. This will cause data race. Data Race Pair: b[i]@42:19 and b[i]@47:9 */ #include #include #include #define N 100 #define C 16 int a; int b[C]; int c[C]; int temp[C]; int main(){ for(int i=0; i=0; i--){ b[i] = temp[i] * a; } } } int val = 0; for(int i=0; i