[llvm-bugs] [Bug 39422] New: Variable used by task is not made firstprivate by default as suggested by the Spec (end of section 2.15.1.1)
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Oct 24 11:46:02 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39422
Bug ID: 39422
Summary: Variable used by task is not made firstprivate by
default as suggested by the Spec (end of section
2.15.1.1)
Product: OpenMP
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Clang Compiler Support
Assignee: unassignedclangbugs at nondot.org
Reporter: simone.at at gmail.com
CC: a.bataev at hotmail.com, llvm-bugs at lists.llvm.org
Created attachment 21032
--> https://bugs.llvm.org/attachment.cgi?id=21032&action=edit
segfaults for missing firstprivate
The attached test that uses task inside a parallel region fails for segfaults.
The issue seems to be that the variable P is not being made threadprivate as it
is suggested in the Specification at the end of the section 2.15.1.1.
----------------------------FROM THE SPEC----------------------------
- In a task generating construct, if no default clause is present, a variable
for which the data-sharing attribute is not determined by the rules above and
that in the enclosing context is determined to be shared by all implicit tasks
bound to the current team is shared.
- In a task generating construct, if no default clause is present, a variable
for which the data-sharing attribute is not determined by the rules above is
firstprivate
----------------------------FROM THE SPEC----------------------------
The segfaults happens with both Clang 6.0 and 7.0. Compiling the test with GCC
and Intel Compiler does not result in an issue.
The behavior is also broken for private variables that have definitely no
dynamic storage duration (just to exclude that the pointer is the
problem):
int main() {
#pragma omp parallel num_threads(NUM_THREADS)
{
int P = omp_get_thread_num();
printf("%d: %d\n", omp_get_thread_num(), P);
#pragma omp task
{
#pragma omp critical
{
printf("%d: %d\n", omp_get_thread_num(), P);
P += 10;
}
}
#pragma omp barrier
printf("%d: %d\n", omp_get_thread_num(), P);
}
}
For firstprivate, the change of P should have no effect outside of the task,
but running the tests P gets affected also outside the task.
--
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/20181024/b3103134/attachment.html>
More information about the llvm-bugs
mailing list