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