<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 - Assertion failure at kmp_runtime.cpp(4277): new_thr->th.th_active == (!0)"
   href="https://bugs.llvm.org/show_bug.cgi?id=41584">41584</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failure at kmp_runtime.cpp(4277): new_thr->th.th_active == (!0)
          </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>jdenny.ornl@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Using clang and openmp built from r359012, I see the following assertion
failure:

$ cat test.c
int main() {
  #pragma omp target teams num_teams(3)
  ;
  return 0;
}
$ clang -fopenmp test.c
$ ./a.out
Assertion failure at kmp_runtime.cpp(4270): new_thr->th.th_active == (!0).
OMP: Error #13: Assertion failure at kmp_runtime.cpp(4270).
OMP: Hint Please submit a bug report with this message, compile and run
commands used, and machine configuration info including native compiler and
operating system versions. Faster response will be obtained by including all
program sources. For information on submitting this issue, please see
<a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a>.
Aborted (core dumped)

If I remove num_threads(3), I see the following instead:

$ clang -fopenmp test.c
$ ./a.out
Assertion failure at z_Linux_util.cpp(1469): (__kmp_thread_pool_active_nth) >=
0.
OMP: Error #13: Assertion failure at z_Linux_util.cpp(1469).
OMP: Hint Please submit a bug report with this message, compile and run
commands used, and machine configuration info including native compiler and
operating system versions. Faster response will be obtained by including all
program sources. For information on submitting this issue, please see
<a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a>.
Aborted (core dumped)

These assertions do not fail every time, so there's a race.  I also see all
this at r357927 but so far never at r357926, so r357927 is the likely culprit.

I built clang and openmp using:

$ clang --version
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ cat /etc/issue
Ubuntu 18.04.2 LTS \n \l</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>