[PATCH] D102061: [flang] [openmp] Add Fortran specific semantic checks for OpenMP Allocate directive.
Kiran Chandramohan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 13 07:49:18 PDT 2021
kiranchandramohan requested changes to this revision.
kiranchandramohan added a comment.
This revision now requires changes to proceed.
A few comments.
================
Comment at: flang/lib/Semantics/check-omp-structure.cpp:1032
+ const parser::DataRef *dataRef) {
+ bool dataRefIsTypeParamInquiry = false;
+ if (const auto *structComp{
----------------
Nit: Use braced initialization.
================
Comment at: flang/lib/Semantics/check-omp-structure.cpp:1059-1069
+ if ((!IsDataRefTypeParamInquiry(dataRef)) &&
+ ((parser::Unwrap<parser::StructureComponent>(ompObject)) ||
+ (parser::Unwrap<parser::ArrayElement>(ompObject)))) {
context_.Say(source,
"A variable that is part of another variable (as an "
"array or structure element)"
" cannot appear in a PRIVATE or SHARED clause or on the ALLOCATE directive."_err_en_US);
----------------
Can you make the type parameter inquiry check the first check and the other one the second and remove (!IsDataRefTypeParamInquiry(dataRef)) from the current first check?
================
Comment at: flang/lib/Semantics/resolve-directives.cpp:1491-1492
+ if ((ompFlag == Symbol::Flag::OmpDeclarativeAllocateDirective ||
+ ompFlag ==
+ Symbol::Flag::OmpExecutableAllocateDirective) &&
ResolveOmpObjectScope(name) == nullptr) {
----------------
Nit: Is this clang-formatted?
================
Comment at: flang/test/Semantics/omp-allocate06.f90:14-15
+
+ !ERROR: List items specified in the ALLOCATE directive must not have the ALLOCATABLE attribute unless the directive is associated with an ALLOCATE statement
+ !$omp allocate(darray) allocator(omp_default_mem_alloc)
+
----------------
The line 15 omp allocate should come before line 11. The line 12 allocate is an executable statement, which makes the line 15 openmp allocate directive an executable allocate.
================
Comment at: flang/test/Semantics/omp-allocate07.f90:23
+ !$omp allocate(w%LEN)
+
+ !ERROR: A type parameter inquiry cannot appear in an ALLOCATE directive
----------------
Can you add a test which has allocate directive having an array's kind?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102061/new/
https://reviews.llvm.org/D102061
More information about the llvm-commits
mailing list