[llvm-bugs] [Bug 50733] New: [OPENMP 4.5]
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jun 16 01:06:35 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50733
Bug ID: 50733
Summary: [OPENMP 4.5]
Product: clang
Version: 10.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: OpenMP
Assignee: unassignedclangbugs at nondot.org
Reporter: xiao.liu at compiler-dev.com
CC: llvm-bugs at lists.llvm.org
The testcase is,
#include <stdio.h>
#define M 10
int b = 10;
int main()
{
int a[M], i;
#pragma omp parallel
{
#pragma omp for linear(b:2)
for (i = 0; i < M; i++) {
a[i] = b;
}
}
for (i = 0; i < M; i++) {
printf("%d ", a[i]);
}
printf("\n%d\n", b);
return 0;
}
The result is,
10 12 14 16 18 20 22 24 26 28
final b: 30
See OpenMP 4.5 specification, 2.15.3.7
"When a linear clause is specified on a construct,(...),The value corresponding
to the sequentially last iteration of the associated loop(s) is assigned to the
original list item."
I think that the final value of 'b' should be 28. And if there is some
assignment to 'b' in the loop, like as,
#pragma omp for linear(b:2)
for (i = 0; i < M; i++) {
a[i] = b;
b += 2;
}
The final value of 'b' should be calculate as, (28+2)=30, instead of
(10+M*2)=30.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210616/b3c61e2d/attachment.html>
More information about the llvm-bugs
mailing list