source: CIVL/examples/omp/DataRaceBench/micro-benchmarks/outputdep-var-yes.c@ e5cec5ae

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since e5cec5ae was 36a61f3, checked in by Ziqing Luo <ziqing@…>, 9 years ago

Commit DataRaceBench into CIVL examples

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@4225 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 462 bytes
Line 
1// This x should be not lastprivate since it is live-in
2// x is both live-in and live-out, and written, cannot be reduction
3//
4// So, the loop cannot be parallelized
5#include <stdio.h>
6#include <stdlib.h>
7
8int main(int argc, char* argv[])
9{
10 int len=100;
11
12 if (argc>1)
13 len = atoi(argv[1]);
14
15 int a[len];
16 int i,x=10;
17
18#pragma omp parallel for
19 for (i=0;i<len;i++)
20 {
21 a[i] = x;
22 x=i;
23 }
24 printf("x=%d, a[0]=%d\n",x,a[0]);
25 return 0;
26}
27
Note: See TracBrowser for help on using the repository browser.