<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - ld cannot link tests with #pragma omp atomic"
   href="https://bugs.llvm.org/show_bug.cgi?id=32506">32506</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ld cannot link tests with #pragma omp atomic
          </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>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Clang Compiler Support
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ilia.taraban@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>==============atomic.c=================
int main(){
  struct {
    char a ;
    int b:16;
  }  s;
  #pragma omp atomic
  s.b++;
}

=======================================

<span class="quote">>>>clang -v</span >
clang version 5.0.0 (trunk 299342)
...

<span class="quote">>>>clang -O0 -fopenmp atomic.c</span >
/tmp/atomic-36a041.o: In function `main':
atomic.c:(.text+0x39): undefined reference to `__atomic_load'
atomic.c:(.text+0x7b): undefined reference to `__atomic_compare_exchange'

But if you add "-latomic":

<span class="quote">>>>clang -O0 -fopenmp atomic.c -latomic
>>></span >
(no errors)</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>