source: CIVL/examples/omp/transform/omp_parallel_ptr_bad.c@ 367a390

main test-branch
Last change on this file since 367a390 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

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

  • Property mode set to 100644
File size: 380 bytes
Line 
1#include <civlc.cvh>
2
3// even to avoid data race
4#ifdef BAD
5#define N 4*2+1
6#else
7#define N 4*2
8#endif
9
10int len = N;
11int gArr[N];
12
13int main () {
14 int *p, *q;
15
16 p = &gArr[0];
17 q = p + (len -1);
18 for (int i=0; i<len; i++)
19 gArr[i] = i;
20
21#pragma omp parallel for firstprivate(len, p, q)
22 for (int i=2; i<len; i+=2) {
23 *q = *p;
24 p = q-1;
25 q = q-2;
26 }
27 return 0;
28}
Note: See TracBrowser for help on using the repository browser.