<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/61230>61230</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Clang][OpenMP] Bug about the linear clause with chucked dynamic schedule
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            openmp
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          PeixinQiao
      </td>
    </tr>
</table>

<pre>
    ```c
#include <stdio.h>
#include <stdlib.h>

void test(int k) {
  int N = 20000, i, j;
  j = 1;
  #pragma omp parallel num_threads(4)
 #pragma omp for linear(j: 2) schedule(dynamic, 200)
  for (i = 1; i <= N/2; ++i) {
    j = j + 2;
  }

  if (j != N + 1) {
 printf("Iter %d, error: j = %d\n", k, j);
    abort();
 }
}

int main() {
  for (int i = 0; i < 1000; ++i)
 test(i);
  return 0;
}
```
```
$ clang case.c -fopenmp && ./a.out
Iter 0, error: j = 1
Aborted (core dumped)
$ clang case.c -fopenmp && ./a.out
Iter 1, error: j = 1
Aborted (core dumped)
$ clang case.c -fopenmp && ./a.out
Iter 0, error: j = 1
Aborted (core dumped)
$ clang case.c -fopenmp && ./a.out
Iter 1, error: j = 1
Aborted (core dumped)
$ clang case.c -fopenmp && ./a.out
Iter 2, error: j = 1
Aborted (core dumped)
$ clang case.c -fopenmp && ./a.out
Iter 2, error: j = 1
Aborted (core dumped)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcVclu4zgQ_ZrSpRCBKlqydNDByxiYw2QyXzCgRNqiQy3gkpn8fYOS7dhB-tKHBroBgxZrfe-RKArn9GlQqoZ8C_k-EcF3o61flP5fD_9oMSbNKN9rKNjya4HtgW2AuB5aE6RC4DvnpR7TDvgf3_Ea3dy75_Vt1BK9ch6o1IPHV6AKYb1dvIjR9ozA90iMMQa0Qx2XM_BbzHn2Z3cWID5ZceoFjv2Ek7DCGGVwCP2_vrNKSAdUroCqS8Jj_HG0aPSghAUqz8A3SBGVazslg1FApXwfRK_bCIQiqGudOTUyuSHC-LmLu2egA0UL0BZoqz8RvdI4Rz_SPZn1_l4xRH2MPWJgNheeM7LHepPVgz8ClUD0p1cRVS4jXmXtaCOnpd1szncDEEXv66ItVXf9EUUzWj_XurN_wHrEF0-sF3pY4u8pXsUZPC4CsZtAmMXDfRDnknW9G4-YrPLBDnOBzyCud_TrLa2wNWI4YSucSlt8Oo6TGvoJgQqgAlOgg0jH4Jf4WTr2hW7Z4t9EZZSMtNrRKpShn5S8of-hdtnPbfd7s6Nfpt31oiay5rLilUhUnRXrMsvLIqekq5titSryhpqiaPLyKCpG2bpay1atpSyIJbomRpxxtmY8YzmlvCooK3NetMeKqmYFK6Z6oU1qzFufjvaUaOeCqouMOEuMaJRx8xNAtFCNUyHfJ7aOCU9NODlYMaOddx8lvPZmfjh2USzI95Bv_57U8NcL5HvchlMcH8Gj79RlqkZZg1P4n_Ydtl1oX5XEy0i9TdkkWFN33k8O-AboAHQ4ad-FJm3HHugQ-1_-niY7nlXrgQ4zHwd0mCl9CwAA__8i3eJQ">