- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The simplified code below will not compile with Intel Compiler C++ 2022 ( C++17 and OpenMP on , obviously).
It compiles with classic 19.2 and runs correctly.
1>ConsoleApplication2.cpp(28,14): : error : reference to local binding 'a' declared in enclosing context
1> DoTask(a, aa);
1> ^
1>ConsoleApplication2.cpp(21,22): note: 'a' declared here
1> for (const auto& [a, b] : data)
#include <iostream>
#include <tuple>
#include <vector>
std::vector<std::pair<int, std::vector<int>>> data;
void DoTask(int a, int b)
{
}
void test()
{
# pragma omp parallel
{
# pragma omp single
{
for (const auto& [a, b] : data)
{
for (const auto& aa : b)
{
if (aa != a)
{
# pragma omp task
DoTask(a, aa);
}
}
}
}
}
}
The workaround is to use functionally identical code that avoids using the C++17 syntactic sugar
void test2()
{
# pragma omp parallel
{
# pragma omp single
{
for ( auto iter =data.begin(); iter!=data.end(); ++iter)
{
const auto &a=iter->first;
const auto &b=iter->second;
for (const auto& aa : b)
{
if (aa != a)
{
# pragma omp task
DoTask(a, aa);
}
}
}
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for letting us known this bug. This is a know issue. See https://bugs.llvm.org/show_bug.cgi?id=33678.
Since there is a workaround and hopefully this bug will be addressed in llvm community at some point, can we close this thread for now?
Regards,
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out to us.
We are also able to reproduce the issue from our end.
We are looking into it. We will get back to you soon.
Thanks & Regards,
Noorjahan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This compilation error is also present in official Clang 13.0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for letting us known this bug. This is a know issue. See https://bugs.llvm.org/show_bug.cgi?id=33678.
Since there is a workaround and hopefully this bug will be addressed in llvm community at some point, can we close this thread for now?
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please close it , I see it has been a bug in Clang for a long time. Very annoying they do not fix it. I reported it again in the clang GitHub issues page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank. This thread will no longer be monitored by Intel. If you need further assistance, please post a new question.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page