<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 - [openmp] runtime/test/affinity/Output/redetect.c test hangs"
   href="https://bugs.llvm.org/show_bug.cgi?id=51403">51403</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[openmp] runtime/test/affinity/Output/redetect.c test hangs
          </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>mgorny@gentoo.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jonathan.l.peyton@intel.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>51236
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I can reliably reproduce this when building with GCC 11.2.0 and Clang
13.0.0-rc1, both when building with -O2 and -O0 -g.

This is on Linux 5.13.8, glibc 2.33, openmp release/13.x branch.

If I'm reading the backtraces right, it seems that the first thread is in
wait(), while all the remaining threads are waiting on a futex.


Process 3138661 stopped
* thread #1, name = 'redetect.c.tmp', stop reason = signal SIGSTOP
    frame #0: 0x00007fd256015d57 libc.so.6`__GI___wait4(pid=-1,
stat_loc=0x00007ffe95b5fbcc, options=0, usage=0x0000000000000000) at
wait4.c:30:10
  thread #2, name = 'redetect.c.tmp', stop reason = signal SIGSTOP
    frame #0: 0x00007fd25612a6c2
libpthread.so.0`__futex_abstimed_wait_common64(futex_word=0x00000000017e45a8,
expected=0, clockid=<unavailable>, abstime=0x0000000000000000,
private=<unavailable>, cancel=<unavailable>) at futex-internal.c:74:11
  thread #3, name = 'redetect.c.tmp', stop reason = signal SIGSTOP
    frame #0: 0x00007fd25612a6c2
libpthread.so.0`__futex_abstimed_wait_common64(futex_word=0x00000000017e73ac,
expected=0, clockid=<unavailable>, abstime=0x0000000000000000,
private=<unavailable>, cancel=<unavailable>) at futex-internal.c:74:11
  thread #4, name = 'redetect.c.tmp', stop reason = signal SIGSTOP
    frame #0: 0x00007fd25612a6c2
libpthread.so.0`__futex_abstimed_wait_common64(futex_word=0x00000000017ea168,
expected=0, clockid=<unavailable>, abstime=0x0000000000000000,
private=<unavailable>, cancel=<unavailable>) at futex-internal.c:74:11
  thread #5, name = 'redetect.c.tmp', stop reason = signal SIGSTOP
    frame #0: 0x00007fd25612a6c2
libpthread.so.0`__futex_abstimed_wait_common64(futex_word=0x00000000017ecf6c,
expected=0, clockid=<unavailable>, abstime=0x0000000000000000,
private=<unavailable>, cancel=<unavailable>) at futex-internal.c:74:11
  thread #6, name = 'redetect.c.tmp', stop reason = signal SIGSTOP
    frame #0: 0x00007fd25612a6c2
libpthread.so.0`__futex_abstimed_wait_common64(futex_word=0x00000000017efd6c,
expected=0, clockid=<unavailable>, abstime=0x0000000000000000,
private=<unavailable>, cancel=<unavailable>) at futex-internal.c:74:11
  thread #7, name = 'redetect.c.tmp', stop reason = signal SIGSTOP
    frame #0: 0x00007fd25612a6c2
libpthread.so.0`__futex_abstimed_wait_common64(futex_word=0x00000000017f2b6c,
expected=0, clockid=<unavailable>, abstime=0x0000000000000000,
private=<unavailable>, cancel=<unavailable>) at futex-internal.c:74:11
  thread #8, name = 'redetect.c.tmp', stop reason = signal SIGSTOP
    frame #0: 0x00007fd25612a6c2
libpthread.so.0`__futex_abstimed_wait_common64(futex_word=0x00000000017f5928,
expected=0, clockid=<unavailable>, abstime=0x0000000000000000,
private=<unavailable>, cancel=<unavailable>) at futex-internal.c:74:11
  thread #9, name = 'redetect.c.tmp', stop reason = signal SIGSTOP
    frame #0: 0x00007fd25612a6c2
libpthread.so.0`__futex_abstimed_wait_common64(futex_word=0x00000000017f8728,
expected=0, clockid=<unavailable>, abstime=0x0000000000000000,
private=<unavailable>, cancel=<unavailable>) at futex-internal.c:74:11
  thread #10, name = 'redetect.c.tmp', stop reason = signal SIGSTOP
    frame #0: 0x00007fd25612a6c2
libpthread.so.0`__futex_abstimed_wait_common64(futex_word=0x00000000017fb528,
expected=0, clockid=<unavailable>, abstime=0x0000000000000000,
private=<unavailable>, cancel=<unavailable>) at futex-internal.c:74:11
  thread #11, name = 'redetect.c.tmp', stop reason = signal SIGSTOP
    frame #0: 0x00007fd25612a6c2
libpthread.so.0`__futex_abstimed_wait_common64(futex_word=0x00000000017fe328,
expected=0, clockid=<unavailable>, abstime=0x0000000000000000,
private=<unavailable>, cancel=<unavailable>) at futex-internal.c:74:11
  thread #12, name = 'redetect.c.tmp', stop reason = signal SIGSTOP
    frame #0: 0x00007fd25612a6c2
libpthread.so.0`__futex_abstimed_wait_common64(futex_word=0x00000000018010e8,
expected=0, clockid=<unavailable>, abstime=0x0000000000000000,
private=<unavailable>, cancel=<unavailable>) at futex-internal.c:74:11
Executable module set to
"/tmp/portage/sys-libs/libomp-13.0.0.9999/work/libomp-13.0.0.9999_build-abi_x86_64.amd64/runtime/test/affinity/Output/redetect.c.tmp".

(lldb) bt
error: libc.so.6 {0x00005c83}: DIE has DW_AT_ranges(DW_FORM_sec_offset 0x42)
attribute, but range extraction failed (invalid range list offset 0x42), please
file a bug and attach the file at the start of this error message
error: libc.so.6 {0x00005e0f}: DIE has DW_AT_ranges(DW_FORM_sec_offset 0x37)
attribute, but range extraction failed (invalid range list offset 0x37), please
file a bug and attach the file at the start of this error message
* thread #1, name = 'redetect.c.tmp', stop reason = signal SIGSTOP
  * frame #0: 0x00007fd256015d57 libc.so.6`__GI___wait4(pid=-1,
stat_loc=0x00007ffe95b5fbcc, options=0, usage=0x0000000000000000) at
wait4.c:30:10
    frame #1: 0x0000000000401762 redetect.c.tmp`main + 562
    frame #2: 0x00007fd255f717fd
libc.so.6`__libc_start_main(main=(redetect.c.tmp`main), argc=1,
argv=0x00007ffe95b600e8, init=<unavailable>, fini=<unavailable>,
rtld_fini=<unavailable>, stack_end=0x00007ffe95b600d8) at libc-start.c:332:16
    frame #3: 0x00000000004011aa redetect.c.tmp`_start + 42

(lldb) thread select 2 
* thread #2, name = 'redetect.c.tmp', stop reason = signal SIGSTOP
    frame #0: 0x00007fd25612a6c2
libpthread.so.0`__futex_abstimed_wait_common64(futex_word=0x00000000017e45a8,
expected=0, clockid=<unavailable>, abstime=0x0000000000000000,
private=<unavailable>, cancel=<unavailable>) at futex-internal.c:74:11
(lldb) bt
* thread #2, name = 'redetect.c.tmp', stop reason = signal SIGSTOP
  * frame #0: 0x00007fd25612a6c2
libpthread.so.0`__futex_abstimed_wait_common64(futex_word=0x00000000017e45a8,
expected=0, clockid=<unavailable>, abstime=0x0000000000000000,
private=<unavailable>, cancel=<unavailable>) at futex-internal.c:74:11
    frame #1: 0x00007fd256123ebf
libpthread.so.0`__pthread_cond_wait(cond=0x00000000017e4580,
mutex=0x00000000017e45c0) at pthread_cond_wait.c:504:10
    frame #2: 0x00007fd25620790d libomp.so`void
__kmp_suspend_template<kmp_flag_64<false, true> >(th_gtid=9,
flag=0x00007fd255ef3e80) at z_Linux_util.cpp:1474:16
    frame #3: 0x00007fd25620c5eb libomp.so`void __kmp_suspend_64<false,
true>(th_gtid=9, flag=0x00007fd255ef3e80) at z_Linux_util.cpp:1526:3
    frame #4: 0x00007fd2561c04fb libomp.so`kmp_flag_64<false,
true>::suspend(this=0x00007fd255ef3e80, th_gtid=9) at kmp_wait_release.h:906:31
    frame #5: 0x00007fd2561bc33a libomp.so`bool
__kmp_wait_template<kmp_flag_64<false, true>, true, false,
true>(this_thr=0x00000000017e4100, flag=0x00007fd255ef3e80,
itt_sync_obj=0x0000000000000000) at kmp_wait_release.h:448:13
    frame #6: 0x00007fd2561c037a libomp.so`kmp_flag_64<false,
true>::wait(this=0x00007fd255ef3e80, this_thr=0x00000000017e4100, final_spin=1,
itt_sync_obj=0x0000000000000000) at kmp_wait_release.h:921:14
    frame #7: 0x00007fd2561b8237
libomp.so`__kmp_hyper_barrier_release(bt=bs_forkjoin_barrier,
this_thr=0x00000000017e4100, gtid=9, tid=-2, propagate_icvs=1,
itt_sync_obj=0x0000000000000000) at kmp_barrier.cpp:649:10
    frame #8: 0x00007fd2561bb891 libomp.so`__kmp_fork_barrier(gtid=9, tid=-2)
at kmp_barrier.cpp:1938:5
    frame #9: 0x00007fd2561836f3
libomp.so`::__kmp_launch_thread(this_thr=0x00000000017e4100) at
kmp_runtime.cpp:5814:5
    frame #10: 0x00007fd2562053a2
libomp.so`__kmp_launch_worker(thr=0x00000000017e4100) at
z_Linux_util.cpp:527:14
    frame #11: 0x00007fd25611de1e
libpthread.so.0`start_thread(arg=0x00007fd255ef4ac0) at pthread_create.c:481:8
    frame #12: 0x00007fd25604916f libc.so.6`__clone at clone.S:95</pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [meta] 13.0.0 Release Blockers"
   href="https://bugs.llvm.org/show_bug.cgi?id=51236">Bug 51236</a>] [meta] 13.0.0 Release Blockers
              </li>
          </ul>
        </div>
        <br>

      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>