Issue 87956
Summary [Flang][OpenMP] Execution does not terminate when the same variable is specified for firstprivate and lastprivate clause in sections construct
Labels openmp, flang
Assignees
Reporter ohno-fj
    ```
Version of flang-new : 19.0.0(cbcdf126ccc774c063b5d5140c1393ff5305dded)/AArch64
```

If the same variable is specified for `firstprivate` and `lastprivate` clause in `sections` construct, the execution does not terminate after about an hour.
Gfortran/ifort completes in less than one second.

If only one of `firstprivate` and `lastprivate` clause is specified, the execution terminates normally.

The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.

omp_PL_SECTIONS_004r_2.f:
```fortran
      program main
      real*4 ra
      integer*4 ib(10), ic , it, ier
 integer*4 :: loop=10, loop2=20000, thread=4
!$    integer*4 OMP_GET_MAX_THREADS
!$    integer*4 OMP_GET_THREAD_NUM
      ra = 15.
      ib = 0
!$    thread = OMP_GET_MAX_THREADS()
!$omp parallel private(it)
!$    it = OMP_GET_THREAD_NUM() + 1
!$omp sections firstprivate(ra) lastprivate(ra)
      ib(it)=ib(it)+it
      do i=1,loop2
         ra=ra+it
      enddo
      ra=loop2*1
!$omp end sections
!$omp end parallel
      end
```

```
$ export OMP_NUM_THREADS=2; flang-new -fopenmp omp_PL_SECTIONS_004r_2.f; time ./a.out
  C-c C-c
real    77m46.270s
user    0m0.378s
sys 0m0.040s
$
```

```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp omp_PL_SECTIONS_004r_2.f; time ./a.out

real 0m0.036s
user    0m0.000s
sys     0m0.015s
$
```

```
$ export OMP_NUM_THREADS=2; ifort -qopenmp -diag-disable=10448 omp_PL_SECTIONS_004r_2.f; time ./a.out

real    0m0.070s
user 0m0.006s
sys     0m0.029s
$
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to