[Flang][OpenMP] Execution error (Aborted) when an allocatable variable is specified in LINEAR clause within SIMD construct
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
```
Version of flang : 23.0.0(f3b96cbf20137562ff069e315f7915524a350d08)/AArch64
```
As shown in the attached program (`sngtli01_2.f90`), when an `allocatable variable` is specified in `LINEAR clause` within `SIMD construct`, the execution terminates abnormally.
I checked `OpenMP 6.0 : 7.5.6 linear Clause`, and the program appears to be correct.
Execution terminates normally in the following cases:
- unused `allocatable variable`
The above is `sngtli01_21.f90`.
The following are the test program, Flang, Gfortran and ifx compilation/execution results.
sngtli01_2.f90:
```fortran
program main
integer,allocatable::a
allocate(a)
a=0
!$omp simd linear(a)
do i=1,2
a = 2
end do
!$omp end simd
print *,'pass'
end program
```
```
$ export OMP_NUM_THREADS=2; flang -fopenmp sngtli01_2.f90; ./a.out
fatal Fortran runtime error(/work/test/sngtli01_2.f90:7): Assign: mismatching types (to code 0 != from code 9)
Aborted (core dumped)
$
```
```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp sngtli01_2.f90; ./a.out
pass
$
```
```
$ export OMP_NUM_THREADS=2; ifx -qopenmp sngtli01_2.f90; ./a.out
pass
$
```
sngtli01_21.f90:
```fortran
program main
integer::a
a=0
!$omp simd linear(a)
do i=1,2
a = 2
end do
!$omp end simd
print *,'pass'
end program
```
```
$ export OMP_NUM_THREADS=2; flang -fopenmp sngtli01_21.f90; ./a.out
pass
$
```
Contributor guide
Assessment
This issue has not been assessed yet.