[Flang][OpenMP] Restrict check to worksharing construct reductions
authorKiran Chandramohan <kiran.chandramohan@arm.com>
Thu, 9 Mar 2023 14:05:08 +0000 (14:05 +0000)
committerKiran Chandramohan <kiran.chandramohan@arm.com>
Thu, 9 Mar 2023 14:13:04 +0000 (14:13 +0000)
commit460c2eaa4ad5dd2b19339d65affa25b00782dcb0
treec2e0ad90de75f37b7ffdc9ccf49072ec9a52bb6e
parent99d053a97d18b8d56c3df203f375703167386a68
[Flang][OpenMP] Restrict check to worksharing construct reductions

The outer context private check for reduction variables was firing
for all constructs. This check is not applicable to non-worksharing
constructs.

OpenMP 5.2: Section 5.5.8
A list item that appears in a reduction clause on a worksharing construct
must be shared in the parallel region to which a correspodning worksharing
region binds.

Reviewed By: peixin

Differential Revision: https://reviews.llvm.org/D144824
flang/lib/Semantics/check-omp-structure.cpp
flang/lib/Semantics/check-omp-structure.h
flang/test/Semantics/OpenMP/reduction07.f90