[PATCH] D109864: [flang][OpenMP] Add semantic checks for threadprivate and declare target directives

Peixin Qiao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 15 18:39:26 PDT 2021


peixin created this revision.
peixin added reviewers: kiranchandramohan, clementval, richard.barton.arm, jdoerfert, sameeranjoshi, praveen, SouraVX, arnamoy10, bryanpkc, Chuanfeng.
peixin added a project: LLVM.
Herald added subscribers: guansong, yaxunl.
Herald added a reviewer: sscalpone.
peixin requested review of this revision.
Herald added subscribers: llvm-commits, sstefan1.

This patch supports the following checks for THREADPRIVATE Directive:

  [5.1] 2.21.2 THREADPRIVATE Directive
  A variable that appears in a threadprivate directive must be declared in
  the scope of a module or have the SAVE attribute, either explicitly or
  implicitly.
  A variable that appears in a threadprivate directive must not be an
  element of a common block or appear in an EQUIVALENCE statement.

This patch supports the following checks for DECLARE TARGET Directive:

  [5.1] 2.14.7 Declare Target Directive
  A variable that is part of another variable (as an array, structure
  element or type parameter inquiry) cannot appear in a declare
  target directive.
  A variable that appears in a declare target directive must be declared
  in the scope of a module or have the SAVE attribute, either explicitly
  or implicitly.
  A variable that appears in a declare target directive must not be an
  element of a common block or appear in an EQUIVALENCE statement.

As Fortran 2018 standard [8.5.16] states, a variable, common block, or
procedure pointer declared in the scoping unit of a main program,
module, or submodule implicitly has the SAVE attribute, which may be
confirmed by explicit specification.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109864

Files:
  flang/lib/Semantics/check-omp-structure.cpp
  flang/lib/Semantics/check-omp-structure.h
  flang/test/Semantics/omp-declarative-directive.f90
  flang/test/Semantics/omp-declare-target01.f90
  flang/test/Semantics/omp-declare-target02.f90
  flang/test/Semantics/omp-threadprivate02.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109864.372847.patch
Type: text/x-patch
Size: 22710 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210916/bcf5f495/attachment-0001.bin>


More information about the llvm-commits mailing list