Commit 8e8113f
[Flang][OpenMP] Allow Fortran BLOCK construct inside WORKSHARE region (#193352)
**Problem**
Flang incorrectly rejects Fortran BLOCK constructs inside OpenMP
WORKSHARE regions. This fixes the semantic check to recursively validate
the contents of BLOCK constructs instead of rejecting them.
The Fortran BLOCK construct (F2008) is a transparent scoping wrapper
that does not affect execution semantics. When a BLOCK appears inside a
WORKSHARE region, the restriction on allowed statements should apply to
the contents of the BLOCK, not the BLOCK construct itself.
**Fix**
The function CheckWorkshareBlockStmts (check-omp-structure.cpp) loops
through each statement inside a WORKSHARE region and checks if it's
allowed.
Before this fix, it only recognized:
```
Assignments, FORALL, WHERE statements
OpenMP constructs (ATOMIC, CRITICAL, PARALLEL)
When it saw a Fortran BLOCK, it didn't recognize it and threw an error.
```
When we see a BLOCK construct, instead of rejecting it, we "look inside"
and check if the statements inside the BLOCK are valid. This is done by
calling the same function recursively on the BLOCK's contents.
Issue : [192930](#192930)
---------
Co-authored-by: Jay Satish Kumar Patel <kumarpat@pe31.hpc.amslabs.hpecorp.net>1 parent f5bb397 commit 8e8113f
2 files changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5590 | 5590 | | |
5591 | 5591 | | |
5592 | 5592 | | |
| 5593 | + | |
| 5594 | + | |
| 5595 | + | |
| 5596 | + | |
| 5597 | + | |
| 5598 | + | |
5593 | 5599 | | |
5594 | 5600 | | |
5595 | 5601 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
0 commit comments