Issue 172938
Summary [Flang][OpenMP] Non-deterministic assertion failure when using complex OpenMP tasks on Arm64
Labels flang
Assignees
Reporter 3776-u2
    ```
Version of flang : 22.0.0git (bcbbe2c2bcbeee4e37ca39c8088bbc0702f7f69c)
Target: aarch64-unknown-linux-gnu
```

On an Arm64 (AArch64) system, a Fortran OpenMP program compiled with Flang non-deterministically (a few times out of 10 executions) aborts with an assertion failure (kmp_tasking.cpp:1836: taskdata->td_last_tied.) during execution. This issue appears to be related to complex task structures, including untied tasks and nested tasks.

``` fortran
program main
  !$ use omp_lib
  integer::a,tid=0
  !$omp parallel
    !$omp sections private(a,tid)
      !$omp section
 a=10
        !$ tid=omp_get_thread_num()
        !$omp task if(mod(tid,2).eq.0) untied default(firstprivate)
          !$omp taskwait
 if (a.ne.10) then
            print *,"NG(3):a=",a
          end if
        !$omp end task
      !$omp section
        a=20
        !$ tid=omp_get_thread_num()
        !$omp task if(mod(tid,2).eq.0) untied default(firstprivate)
          !$omp task untied default(private)
 a=200
          !$omp end task
          !$omp taskwait
          if (a.ne.20) then
            print *,"NG(7):a=",a
          end if
 !$omp end task
      !$omp end sections
  !$omp end parallel

  print *,"pass"
end program main

```


``` text
$ export OMP_NUM_THREADS=32
$ /work/groups/ssoft/compiler/llvm/aarch64/main-latest/bin/flang  sample.f90 -fopenmp
$ ./a.out
 pass
$ ./a.out
 pass
$ ./a.out
Assertion failure at kmp_tasking.cpp(1836): taskdata->td_last_tied.
OMP: Error #13: Assertion failure at kmp_tasking.cpp(1836).
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/.
Aborted (core dumped)
$
$ gfortran -fopenmp  sample.f90
$ for i in $(seq 1 10) ; do ./a.out ; done
 pass
 pass
 pass
 pass
 pass
 pass
 pass
 pass
 pass
 pass
$
```
``` text
$ ifx sample.f90 -qopenmp
$ for i in $(seq 1 20); do ./a.out; done
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to