| Issue |
170781
|
| Summary |
[Flang][OpenMP] Execution error (Aborted) when write or print statement exists within task construct
|
| Labels |
flang:openmp
|
| Assignees |
|
| Reporter |
ohno-fj
|
```
Version of flang : 22.0.0(f42e58f61680e325555f382cab5115c54df6f6df)/AArch64
```
In the attached program (`snes_task_010_2.f90`), when `write or print statement` exists within `task construct`, the execution terminates abnormally.
The above occurs when using compilation options of -O1 or higher.
Execution terminates normally in the following cases:
- Specify the compilation option (-O0), or
- Chang the array specified in `write statement` to a scalar variable
Example: Modify line 2
- Before correction: integer :: i5(1)
- After correction: integer :: i5
The following are the test program, Flang, Gfortran and ifx compilation/execution results.
snes_task_010_2.f90:
```fortran
program main
integer :: i5(1)
i5=99
!$omp parallel
!$omp task private(i5)
i5=5
!$omp end task
!$omp task
write(6,*) "i5 = ", i5
!$omp end task
!$omp end parallel
print *,'pass'
end program main
```
```
$ export OMP_NUM_THREADS=2; flang -O0 -fopenmp snes_task_010_2.f90; ./a.out
i5 = 99
i5 = 99
pass
$
```
```
$ export OMP_NUM_THREADS=2; flang -O1 -fopenmp snes_task_010_2.f90; ./a.out
fatal Fortran runtime error(/work/home/ohno/snes_task_010_2.f90:11): DescriptorIO: bad type code (64) in descriptor
i5 = Aborted (core dumped)
$
```
```
$ export OMP_NUM_THREADS=2; flang -O2 -fopenmp snes_task_010_2.f90; ./a.out
fatal Fortran runtime error(/work/home/ohno/snes_task_010_2.f90:11): DescriptorIO: bad type code (64) in descriptor
i5 = Aborted (core dumped)
$
```
```
$ export OMP_NUM_THREADS=2; flang -O3 -fopenmp snes_task_010_2.f90; ./a.out
fatal Fortran runtime error(/work/home/ohno/snes_task_010_2.f90:11): DescriptorIO: bad type code (64) in descriptor
i5 = Aborted (core dumped)
$
```
```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp snes_task_010_2.f90; ./a.out
i5 = 99
i5 = 99
pass
$
```
```
$ export OMP_NUM_THREADS=2; ifx -qopenmp snes_task_010_2.f90; ./a.out
i5 = 99
i5 = 99
pass
$
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs