[llvm-bugs] [Bug 27828] Firstprivate in for directive does not work properly.
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon May 23 09:52:34 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27828
Samuel Antao <sfantao at us.ibm.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|INVALID |---
--- Comment #2 from Samuel Antao <sfantao at us.ibm.com> ---
Hi Alexey,
Sorry I messed up the repro when I was reducing it. So, here's an updated one
that shows the problem:
#include <stdio.h>
int main(void) {
int a = 2;
#pragma omp parallel if(0)
{
#pragma omp for firstprivate(a)
for (int i = 0; i < 1; i++) {
printf(" Hi from first loop --> %d!\n", a);
a += 1;
}
#pragma omp for firstprivate(a)
for (int i = 0; i < 1; i++) {
printf(" Hi from second loop --> %d!\n", a);
a += 1;
}
}
printf(" Final --> %d\n", a);
return 0;
}
I get:
Hi from first loop --> 2!
Hi from second loop --> 3!
Final --> 2
So `a` is privatized in the parallel scope but not for each loop.
Thanks!
Samuel
--
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/20160523/0c0f4026/attachment.html>
More information about the llvm-bugs
mailing list