source:
CIVL/examples/omp/DataRaceBench/micro-benchmarks/truedep1-var-yes.c@
e5cec5ae
| Last change on this file since e5cec5ae was 36a61f3, checked in by , 9 years ago | |
|---|---|
|
|
| File size: 324 bytes | |
| Line | |
|---|---|
| 1 | // This one has race condition due to true dependence |
| 2 | #include <stdlib.h> |
| 3 | #include <stdio.h> |
| 4 | |
| 5 | int main(int argc, char* argv[]) |
| 6 | { |
| 7 | int i; |
| 8 | int len=100; |
| 9 | |
| 10 | if (argc>1) len = atoi(argv[1]); |
| 11 | |
| 12 | int a[len]; |
| 13 | for (i=0;i<len;i++) |
| 14 | a[i]=i; |
| 15 | |
| 16 | #pragma omp parallel for |
| 17 | for (i=0;i<len-1;i++) |
| 18 | a[i+1]=a[i]+1; |
| 19 | |
| 20 | return 0; |
| 21 | } |
Note:
See TracBrowser
for help on using the repository browser.
