<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - OpenMP linear clause - wrong results"
   href="https://llvm.org/bugs/show_bug.cgi?id=28581">28581</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>OpenMP linear clause - wrong results
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>carlo.bertolli@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>