The compiler detects some restrictions noted in the OpenMP API Versions 2.0 and 2.5. When static verification is enabled, the compiler performs some additional checks against restrictions in the OpenMP API, including checks for the correct use of the following:
Static verification checks for data dependencies between objects in loops with parallel directives, like !$OMP PARALLEL DO or !$OMP DO inside parallel region.
It then applies the compiler's algorithms for dependence analysis and also other algorithms to expand data dependence analysis to the global program context.
Example 1:
1 #include <stdio.h>
2 int
3 main() {
4 int j;
5 float a[100], b[100];
6 b[0] = 1.0;
7 a[0] = 2.0 ;
8 #pragma omp parallel shared(a,b)
9 #pragma omp for
10 for (j=1;j<100;j++) {
11 a[j] = 3.6*b[j-1];
12 b[j] = a[j-1]/3;
13 }
14 for(j=0;j<100;j++)
15 printf("%f %f\n", a[j], b[j]);
16 printf("\n");
17 return 0;
18 }
Static verification issues the following warnings:
omp.c(11): warning #12251: flow data dependence from line 11 to line 12, due to "a" may lead to incorrect program execution in parallel mode
omp.c(12): warning #12251: flow data dependence from line 12 to line 11, due to "b" may lead to incorrect program execution in parallel mode