<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/111140>111140</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [openmp] Spurious failures in tasking/issue-69733.c
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            openmp:libomp
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          nikic
      </td>
    </tr>
</table>

<pre>
    This test has occasional spurious failures that look like this:
```

******************** TEST 'libomp :: tasking/issue-69733.c' FAILED ********************
Exit Code: -6
Command Output (stdout):
--
# RUN: at line 1
/builddir/build/BUILD/llvm-19.1.0-build/llvm-project-19.1.0.src/llvm/redhat-linux-build/./bin/clang -fopenmp   -I /builddir/build/BUILD/llvm-19.1.0-build/llvm-project-19.1.0.src/llvm/redhat-linux-build/runtimes/runtimes-bins/openmp/runtime/src -I /builddir/build/BUILD/llvm-19.1.0-build/llvm-project-19.1.0.src/openmp/runtime/test -L /builddir/build/BUILD/llvm-19.1.0-build/llvm-project-19.1.0.src/llvm/redhat-linux-build/runtimes/runtimes-bins/openmp/runtime/src -fno-omit-frame-pointer -I /builddir/build/BUILD/llvm-19.1.0-build/llvm-project-19.1.0.src/openmp/runtime/test/ompt /builddir/build/BUILD/llvm-19.1.0-build/llvm-project-19.1.0.src/openmp/runtime/test/tasking/issue-69733.c -o /builddir/build/BUILD/llvm-19.1.0-build/llvm-project-19.1.0.src/llvm/redhat-linux-build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-69733.c.tmp -lm -latomic && /builddir/build/BUILD/llvm-19.1.0-build/llvm-project-19.1.0.src/llvm/redhat-linux-build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-69733.c.tmp
# executed command: /builddir/build/BUILD/llvm-19.1.0-build/llvm-project-19.1.0.src/llvm/redhat-linux-build/./bin/clang -fopenmp -I /builddir/build/BUILD/llvm-19.1.0-build/llvm-project-19.1.0.src/llvm/redhat-linux-build/runtimes/runtimes-bins/openmp/runtime/src -I /builddir/build/BUILD/llvm-19.1.0-build/llvm-project-19.1.0.src/openmp/runtime/test -L /builddir/build/BUILD/llvm-19.1.0-build/llvm-project-19.1.0.src/llvm/redhat-linux-build/runtimes/runtimes-bins/openmp/runtime/src -fno-omit-frame-pointer -I /builddir/build/BUILD/llvm-19.1.0-build/llvm-project-19.1.0.src/openmp/runtime/test/ompt /builddir/build/BUILD/llvm-19.1.0-build/llvm-project-19.1.0.src/openmp/runtime/test/tasking/issue-69733.c -o /builddir/build/BUILD/llvm-19.1.0-build/llvm-project-19.1.0.src/llvm/redhat-linux-build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-69733.c.tmp -lm -latomic
# executed command: /builddir/build/BUILD/llvm-19.1.0-build/llvm-project-19.1.0.src/llvm/redhat-linux-build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-69733.c.tmp
# .---command stderr------------
# | Assertion failure at kmp_tasking.cpp(3248): victim_tid < task_team->tt.tt_nproc.
# | OMP: Error #13: Assertion failure at kmp_tasking.cpp(3248).
# | 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 https://github.com/llvm/llvm-project/issues/.
# `-----------------------------
# error: command failed with exit status: -6
```
The failing assertion is: https://github.com/llvm/llvm-project/blob/800b07396ff54b037fa9b73bb15586456656fb79/openmp/runtime/src/kmp_tasking.cpp#L3248

We've observed this failure on at least aarch64 and ppc64le with the following hardware info.
<details>

aarch64:
```
CPU info:
Architecture:                         aarch64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s):                               12
On-line CPU(s) list:                  0-11
Vendor ID: ARM
Model name:                           Neoverse-N1
Model: 1
Thread(s) per core:                   1
Core(s) per socket:                   1
Socket(s): 12
Stepping:                             r3p1
BogoMIPS: 50.00
Flags:                                fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
NUMA node(s):                         1
NUMA node0 CPU(s): 0-11
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected


Memory:
               total        used        free shared  buff/cache   available
Mem:        36856228     1167536 7727496         320    28375948    35688692
Swap:        8388604 38912     8349692


Storage (chroot, cache_topdir):
Filesystem Type   Size  Used Avail Use% Mounted on
/dev/vda3      btrfs  313G  9.6G 300G   4% /
/dev/vda3      btrfs  313G  9.6G  300G   4% /
```

ppc64le:
```
CPU info:
Architecture: ppc64le
Byte Order:          Little Endian
CPU(s): 20
On-line CPU(s) list: 0-19
Thread(s) per core:  1
Core(s) per socket:  1
Socket(s):           20
NUMA node(s):        1
Model: 2.2 (pvr 004e 1202)
Model name:          POWER9 (architected), altivec supported
Hypervisor vendor:   KVM
Virtualization type: para
L1d cache:           32K
L1i cache:           32K
NUMA node0 CPU(s):   0-19


Memory:
              total        used free      shared  buff/cache   available
Mem:       32660096     1275712 28277248      127424     3107136    30567872
Swap:       2097088 183680     1913408


Storage (chroot, cache_topdir):
Filesystem Size  Used Avail Use% Mounted on
/dev/mapper/vg_ppc64le--01-root  417G  4.8G  391G   2% /
/dev/mapper/vg_ppc64le--01-root  417G  4.8G  391G   2% /
```

</details>

The test was added in https://github.com/llvm/llvm-project/pull/86859, cc @jpeyton52.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsW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