cpp: #include <assert.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n#define N 180\nint indexSet[N] = {\n521, 523, 525, 533, 529, 531, // 521+12=533\n547, 549, 551, 553, 555, 557,\n573, 575, 577, 579, 581, 583,\n599, 601, 603, 605, 607, 609,\n625, 627, 629, 631, 633, 635,\n\n651, 653, 655, 657, 659, 661,\n859, 861, 863, 865, 867, 869,\n885, 887, 889, 891, 893, 895,\n911, 913, 915, 917, 919, 921, \n937, 939, 941, 943, 945, 947,\n\n963, 965, 967, 969, 971, 973,\n989, 991, 993, 995, 997, 999, \n1197, 1199, 1201, 1203, 1205, 1207,\n1223, 1225, 1227, 1229, 1231, 1233,\n1249, 1251, 1253, 1255, 1257, 1259,\n\n1275, 1277, 1279, 1281, 1283, 1285,\n1301, 1303, 1305, 1307, 1309, 1311,\n1327, 1329, 1331, 1333, 1335, 1337,\n1535, 1537, 1539, 1541, 1543, 1545,\n1561, 1563, 1565, 1567, 1569, 1571,\n\n1587, 1589, 1591, 1593, 1595, 1597,\n1613, 1615, 1617, 1619, 1621, 1623,\n1639, 1641, 1643, 1645, 1647, 1649,\n1665, 1667, 1669, 1671, 1673, 1675,\n1873, 1875, 1877, 1879, 1881, 1883,\n\n1899, 1901, 1903, 1905, 1907, 1909,\n1925, 1927, 1929, 1931, 1933, 1935,\n1951, 1953, 1955, 1957, 1959, 1961,\n1977, 1979, 1981, 1983, 1985, 1987,\n2003, 2005, 2007, 2009, 2011, 2013};\n\nint main (int argc, char* argv[])\n{\n  double * base = (double*) malloc(sizeof(double)* (2013+12+1));\n  if (base == 0)\n  {\n    printf ("Error in malloc(). Aborting ...\n");\n    return 1;  \n  }\n\n  double * xa1 = base;\n  double * xa2 = xa1 + 12;\n  int i;\n\n  // initialize segments touched by indexSet\n  for (i =521; i<= 2025; ++i)\n  {\n    base[i]=0.5*i;\n  }\n\n#pragma omp parallel for // default static even scheduling may not trigger data race!\n  for (i =0; i< N; ++i) \n  {\n    int idx = indexSet[i];\n    xa1[idx]+= 1.0;\n    xa2[idx]+= 3.0;\n  }\n  printf("x1[999]=%f xa2[1285]=%f\n", xa1[999], xa2[1285]);\n  free (base);\n  return  0;\n}\n\n
fortran: program DRB007_indirectaccess3_orig_yes\n    use omp_lib\n    use DRB007\n    implicit none\n\n    integer :: i, idx1, idx2\n    integer, parameter :: dp = kind(1.0d0)\n    real(dp), dimension(:), pointer :: xa1=>NULL(), xa2=>NULL()\n    real(dp), dimension(2025), target :: base\n\n    allocate (xa1(2025))\n    allocate (xa2(2025))\n\n    xa1 => base(1:2025)\n    xa2 => base(1:2025)\n\n    n=180\n\n    indexSet = (/ 521, 523, 525, 533, 529, 531, 547, 549, &\n    551, 553, 555, 557, 573, 575, 577, 579, 581, 583, 599, &\n    601, 603, 605, 607, 609, 625, 627, 629, 631, 633, 635, &\n    651, 653, 655, 657, 659, 661, 859, 861, 863, 865, 867, &\n    869, 885, 887, 889, 891, 893, 895, 911, 913, 915, 917, &\n    919, 921, 937, 939, 941, 943, 945, 947, 963, 965, 967, &\n    969, 971, 973, 989, 991, 993, 995, 997, 999, 1197, 1199, &\n    1201, 1203, 1205, 1207, 1223, 1225, 1227, 1229, 1231, &\n    1233, 1249, 1251, 1253, 1255, 1257, 1259, 1275, 1277, &\n    1279, 1281, 1283, 1285, 1301, 1303, 1305, 1307, 1309, &\n    1311, 1327, 1329, 1331, 1333, 1335, 1337, 1535, 1537, &\n    1539, 1541, 1543, 1545, 1561, 1563, 1565, 1567, 1569, &\n    1571, 1587, 1589, 1591, 1593, 1595, 1597, 1613, 1615, &\n    1617, 1619, 1621, 1623, 1639, 1641, 1643, 1645, 1647, &\n    1649, 1665, 1667, 1669, 1671, 1673, 1675, 1873, 1875, &\n    1877, 1879, 1881, 1883, 1899, 1901, 1903, 1905, 1907, &\n    1909, 1925, 1927, 1929, 1931, 1933, 1935, 1951, 1953, &\n    1955, 1957, 1959, 1961, 1977, 1979, 1981, 1983, 1985, &\n    1987, 2003, 2005, 2007, 2009, 2011, 2013 /)\n\n    do i = 521, 2025\n        base(i) = 0.5*i\n    end do\n\n    !$omp parallel do\n    do i = 1, n\n        idx1 = indexSet(i)\n        idx2 = indexSet(i)+12\n        base(idx1) = base(idx1)+1.0\n        base(idx2) = base(idx2)+3.0\n    end do\n    !$omp end parallel do\n\n    print*,'xa1(999) =',base(999),' xa2(1285) =',base(1285)\n\n    nullify(xa1,xa2)\nend program