[Openmp-dev] Behavior of linear clause on omp simd
Arpith C Jacob via Openmp-dev
openmp-dev at lists.llvm.org
Fri Nov 18 12:02:38 PST 2016
Hi,
I wanted to understand if the linear clause on a simd directive is behaving
according to spec. Consider the following program:
---
#include <stdio.h>
int main() {
int a[11];
int lin = 1;
#pragma omp simd linear(lin:2)
for (int i=1; i<=10; i++) {
a[i] = lin;
}
printf("linear= %d\n", lin);
printf("A = \n");
for (int i=1; i<=10; i++) {
printf("%d ", a[i]);
}
printf("\n");
return 0;
}
---
Output:
linear= 21
A =
1 3 5 7 9 11 13 15 17 19
The variable 'lin' has a value of '21' after the simd loop. According to
the spec, should it have a value of '19' instead?
> The value corresponding to the sequentially last iteration of the
> associated loop(s) is assigned to the original list item.
Thanks,
Arpith
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20161118/7a034aba/attachment.html>
More information about the Openmp-dev
mailing list