https://llvm.org/bugs/show_bug.cgi?id=27828

Samuel Antao <sfan...@us.ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #2 from Samuel Antao <sfan...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to