[llvm-bugs] [Bug 27828] New: Firstprivate in for directive does not work properly.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 20 14:58:47 PDT 2016


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

            Bug ID: 27828
           Summary: Firstprivate in for directive does not work properly.
           Product: OpenMP
           Version: unspecified
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sfantao at us.ibm.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following repro prints 43 instead of 23. The variable `a` is not getting
privatized in the `for` loop. I was not sure if this is a bug or related to
work under progress. 

#include <stdio.h>

int main (void) {
  int a = 23;

  #pragma omp parallel num_threads(1)
  {
    #pragma for firstprivate(a)
    for (int i=0 ; i<10; ++i)
      ++a;

    #pragma for firstprivate(a)
    for (int i=0 ; i<10; ++i)
      ++a;
  }

  printf(" --> %d\n", a);
  return 0;
}

-- 
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/20160520/fc3462db/attachment.html>


More information about the llvm-bugs mailing list