Issue 184923
Summary [Flang][OpenMP] Compile error of specifying an element of common block within LINEAR clause
Labels flang:openmp
Assignees
Reporter ohno-fj
    ```
Version of flang : 23.0.0(d9ca61b6e7b9aa94d244b831a3cb6274d3839d1c)/AArch64
```

In the attached program (`sample.f90`), specifying an element (`k`) of `common block` within `LINEAR clause` results in the following compilation error:
 `error: 'k' is common block name and must not appear in an LINEAR clause`

The restrictions in `OpenMP 6.0 : 7.5.6 linear Clause` include the following statement:
  `A common block name must not be a list item in a linear clause.`

The `k` written within the attached program (`sample.f90`) is not `common block name`, but an element of `common block`.
Therefore, the compile-time error appears to be incorrect.

The following are the test program, Flang, Gfortran and ifx compilation/execution results.

sample.f90:
```fortran
program main
  common /com/k
!$omp simd linear(k)
  do j=1,10
  end do
  print *,"pass"
end program main
```

```
$ flang -fopenmp sample.f90
error: Semantic errors in sample.f90
./sample.f90:3:19: error: 'k' is a common block name and must not appear in an LINEAR clause
  !$omp simd linear(k)
 ^
$
```

```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp sample.f90; ./a.out
 pass
$
```

```
$ export OMP_NUM_THREADS=2; ifx -qopenmp sample.f90; ./a.out
 pass
$
```

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

Reply via email to