| | 114 | * Example 1: (`DRB067-restrictpointer1-orig-no.c` from [https://github.com/LLNL/dataracebench/releases/tag/v1.2.0 DataRaceBench v1.2.0]) |
| | 115 | {{{ |
| | 116 | #include <stdlib.h> |
| | 117 | typedef double real8; |
| | 118 | |
| | 119 | void foo(real8 * restrict newSxx, real8 * restrict newSyy, int length) |
| | 120 | { |
| | 121 | int i; |
| | 122 | |
| | 123 | #pragma omp parallel for private (i) firstprivate (length) |
| | 124 | for (i = 0; i <= length - 1; i += 1) { |
| | 125 | newSxx[i] = 0.0; |
| | 126 | newSyy[i] = 0.0; |
| | 127 | } |
| | 128 | } |
| | 129 | |
| | 130 | int main() |
| | 131 | { |
| | 132 | int length=10; |
| | 133 | real8* newSxx = malloc (length* sizeof (real8)); |
| | 134 | real8* newSyy = malloc (length* sizeof (real8)); |
| | 135 | |
| | 136 | foo(newSxx, newSyy, length); |
| | 137 | |
| | 138 | free (newSxx); |
| | 139 | free (newSyy); |
| | 140 | return 0; |
| | 141 | } |
| | 142 | }}} |
| | 143 | * The OpenMP simplifier analyzes the parallel region with points-to informations about the two pointer argument `newSxx` and `newSyy` from static analysis. |
| | 144 | * The OpenMP simplifier can determine that no data race will happen in the parallel region as long as no array out-of-bound error happens in it. |
| | 145 | * The OpenMP simplifier sequentializes the program which will be checked by CIVL. Any possible array out-of-bound error will be caught by CIVL. |