Issue 182401
Summary [Flang][OpenMP] Execution error (Aborted) when an allocatable variable is specified in LINEAR clause within SIMD construct
Labels flang:openmp
Assignees
Reporter ohno-fj
    ```
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
$
```


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

Reply via email to