[llvm-bugs] [Bug 28581] New: OpenMP linear clause - wrong results

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 15 19:57:27 PDT 2016


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

            Bug ID: 28581
           Summary: OpenMP linear clause - wrong results
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: carlo.bertolli at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following program:

#include <stdio.h>


int main() {
  int j = 0;
#pragma omp parallel for linear(j:10)
  for(int i = 0 ; i < 10 ; i++) {
    printf("i = %d, j = %d\n", i, j);
  }

  return 0;
}

prints the following unexpected result:

i = 3, j = 30
i = 1, j = 10
i = 2, j = 20
i = 4, j = 40
i = 7, j = 70
i = 6, j = 60
i = 5, j = 50
i = 8, j = 80
i = 9, j = 90
i = 0, j = 100

While I would expect the following:

i = 3, j = 30
i = 1, j = 10
i = 2, j = 20
i = 4, j = 40
i = 7, j = 70
i = 6, j = 60
i = 5, j = 50
i = 8, j = 80
i = 9, j = 90
i = 0, j = 0

or some other ordering of the prints with same values.

My input program may be wrong - happy to be told that!

Thanks

-- Carlo

-- 
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/20160716/c8bc59fd/attachment.html>


More information about the llvm-bugs mailing list