source:
CIVL/examples/omp/DataRaceBench/micro-benchmarks/antidep1-orig-yes.c@
e5cec5ae
| Last change on this file since e5cec5ae was 36a61f3, checked in by , 9 years ago | |
|---|---|
|
|
| File size: 303 bytes | |
| Rev | Line | |
|---|---|---|
| [36a61f3] | 1 | // Race condition due to anti-dependence |
| 2 | #include <stdio.h> | |
| 3 | int main(int argc, char* argv[]) | |
| 4 | { | |
| 5 | int i; | |
| 6 | int len = 1000; | |
| 7 | ||
| 8 | int a[1000]; | |
| 9 | ||
| 10 | for (i=0; i<len; i++) | |
| 11 | a[i]= i; | |
| 12 | ||
| 13 | #pragma omp parallel for | |
| 14 | for (i=0;i< len -1 ;i++) | |
| 15 | a[i]=a[i+1]+1; | |
| 16 | ||
| 17 | printf ("a[500]=%d\n", a[500] ); | |
| 18 | return 0; | |
| 19 | } |
Note:
See TracBrowser
for help on using the repository browser.
