<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 --- - simple use of reference variable gives incorrect result"
   href="https://llvm.org/bugs/show_bug.cgi?id=25042">25042</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>simple use of reference variable gives incorrect result
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>Runtime Library
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>llvmbugzilla@jackwasey.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>(See
<a href="https://stackoverflow.com/questions/32572966/did-i-misuse-a-reference-variable-in-a-simple-openmp-for-loop-or-is-it-a-clang">https://stackoverflow.com/questions/32572966/did-i-misuse-a-reference-variable-in-a-simple-openmp-for-loop-or-is-it-a-clang</a>)

Comparing clang-3.8 head from SVN to clang 3.7 release from SVN, compiled with
libc++ and libomp:

#include <vector>
#include <iostream>
// including or excluding omp makes no difference
#include <omp.h>

void doSomething(std::vector<int> &k) {
#pragma omp for
    for (int i=0; i<2; ++i) {
            std::cout << k.size() << "\n";
    }
}

int main() {
    std::vector<int> v;
    v.push_back(1);

    std::vector<int> &j = v;
    doSomething(j);
    return(0);
}

clang-3.7++ -fopenmp clang-err.cpp
./a.out
18446708892352074976
18446708892352074976


clang-3.8++ -fopenmp clang-err.cpp
./a.out
1
1</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>