[llvm-bugs] [Bug 39372] New: Does not complains about loop bound variable not being shared
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Oct 21 03:35:55 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39372
Bug ID: 39372
Summary: Does not complains about loop bound variable not being
shared
Product: OpenMP
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Clang Compiler Support
Assignee: unassignedclangbugs at nondot.org
Reporter: lebedev.ri at gmail.com
CC: llvm-bugs at lists.llvm.org
Originally reported as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87668
https://godbolt.org/z/05Zgdd
#include <vector>
struct b {};
void c() {
std::vector<b> d;
#ifdef _OPENMP
#pragma omp parallel default(none)
#pragma omp for
#endif
for (auto f = d.begin(); f < d.end(); ++f)
;
}
#ifndef _OPENMP
Yes, there is OMP.
#endif
GCC output:
<source>: In function 'void c()':
<source>:9:25: error: 'd' not specified in enclosing 'parallel'
for (auto f = d.begin(); f < d.end(); ++f)
^
<source>:6:9: error: enclosing 'parallel'
#pragma omp parallel default(none)
^~~
Compiler returned: 1
Clang is perfectly happy with that code.
Jakub Jelinek 2018-10-21 10:22:10 UTC
GCC is correct here.
Even with the recent 5.0 clarifications, those expressions are to be evaluated
before the worksharing-loop construct, but still inside of the parallel region,
so with default(none) d needs to be specified on the parallel (e.g. shared or
firstprivate).
--
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/20181021/6ec2ff34/attachment.html>
More information about the llvm-bugs
mailing list