| Issue |
183636
|
| Summary |
[Flang][OpenMP] Execution error (Aborted) of allocating a variable that is an element of the same common block and has PRIVATE clause within both PARALLEL construct and the inner TASK construct
|
| Labels |
flang:openmp
|
| Assignees |
|
| Reporter |
ohno-fj
|
```
Version of flang : 23.0.0(3f024d08355d40e935d89c19d799ccdd298e95a7)/AArch64
```
In the attached program (`dw1_107_tsk_21.f90`), a `variable (k)` that is an element of the `common block` and has `pointer attribute` is specified in `private clause` of both `parallel private construct` and `task private construct`.
`parallel private construct` and `task private construct` each contain `allocate statement` with `variable(k)` specified as an argument.
This program terminates abnormally at runtime due to `allocate statement` within `task private construct`.
According to `Fortran Standard 2023: 9.7.1.4 Allocation of pointer targets`, this program does not appear to be specifically incorrect.
In the following cases, execution terminates normally:
- remove `common statement`
The above is `dw1_107_tsk_22.f90`.
The following are the test program, Flang, Gfortran and ifx compilation/execution results.
dw1_107_tsk_21.f90:
```fortran
program main
integer,pointer :: k
common /com/ k
!$omp parallel private(k)
allocate(k)
!$omp task private(k)
allocate(k)
deallocate(k)
!$omp end task
deallocate(k)
!$omp end parallel
print *,'ok'
end program main
```
```
$ export OMP_NUM_THREADS=2; flang -fopenmp dw1_107_tsk_21.f90; ./a.out
fatal Fortran runtime error(/work/test/dw1_107_tsk_21.f90:8): Invalid descriptor
fatal Fortran runtime error(/work/test/dw1_107_tsk_21.f90:8Aborted (core dumped)
$
```
```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp dw1_107_tsk_21.f90; ./a.out
ok
$
```
```
$ export OMP_NUM_THREADS=2; ifx -qopenmp dw1_107_tsk_21.f90; ./a.out
ok
$
```
dw1_107_tsk_22.f90:
```fortran
program main
integer,pointer :: k
! common /com/ k
!$omp parallel private(k)
allocate(k)
!$omp task private(k)
allocate(k)
deallocate(k)
!$omp end task
deallocate(k)
!$omp end parallel
print *,'ok'
end program main
```
```
$ export OMP_NUM_THREADS=2; flang -fopenmp dw1_107_tsk_22.f90; ./a.out
ok
$
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs