[all-commits] [llvm/llvm-project] 6ab6b8: [Flang][OpenMP]add semantic check for linear claus...
jay0x via All-commits
all-commits at lists.llvm.org
Fri Jun 5 01:40:44 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6ab6b803f552d909341e3c561e84ef9bc6beefe0
https://github.com/llvm/llvm-project/commit/6ab6b803f552d909341e3c561e84ef9bc6beefe0
Author: jay0x <90309873+blazie2004 at users.noreply.github.com>
Date: 2026-06-05 (Fri, 05 Jun 2026)
Changed paths:
M flang/lib/Semantics/resolve-directives.cpp
M flang/test/Semantics/OpenMP/private03.f90
Log Message:
-----------
[Flang][OpenMP]add semantic check for linear clause with statement function variables (#199743)
### **Description**
1. This patch adds a missing semantic check for the LINEAR clause.
2. OpenMP treats LINEAR variables similarly to PRIVATE variables.
Variables used inside statement function expressions are not allowed to
be privatized, but Flang was not checking this for LINEAR.
3. The existing privatization check already handled PRIVATE,
FIRSTPRIVATE, and LASTPRIVATE. This patch extends the same check to
LINEAR.
Fixes : [199660](https://github.com/llvm/llvm-project/issues/199660)
### **Reproducer**
```
subroutine test()
integer :: pi, r, f, x
f(r) = pi * r + x
!$omp parallel do linear(x)
do r = 1, 10
pi = f(r)
end do
!$omp end parallel do
end subroutine
```
when compiled with : `-fopenmp -fopenmp-version=45 -c`
**Observed Behavior**
` No diagnostic emitted
`
**Expected Behavior**
```
error: Variable 'x' in statement function expression cannot be in a LINEAR clause
!$omp parallel do linear(x)
```
Co-authored-by: Jay Satish Kumar Patel <kumarpat at pe31.hpc.amslabs.hpecorp.net>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list