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