[flang] Enforce constraint C1128 for DO CONCURRENT locality-spec's
authorPeter Steinfeld <psteinfeld@nvidia.com>
Tue, 2 Jul 2019 19:10:09 +0000 (12:10 -0700)
committerPeter Steinfeld <psteinfeld@nvidia.com>
Wed, 3 Jul 2019 20:50:56 +0000 (13:50 -0700)
commit84b70d8b73c870bc8297ebcc2ffd0340b418b752
treec158d8d718dc2dda31d3882e6f9945c419d833ea
parentf8da811848fae772c92c88802af399c8c7c8fd8b
[flang] Enforce constraint C1128 for DO CONCURRENT locality-spec's

These changes implement most of the requirements for C1128, which says: "A
variable-name that appears in a LOCAL or LOCAL_INIT locality-spec shall not
have the ALLOCATABLE; INTENT (IN); or OPTIONAL attribute; shall not be of
finalizable type; shall not be a nonpointer polymorphic dummy argument; and
shall not be a coarray or an assumed-size array.  A variable-name that is not
permitted to appear in a variable definition context shall not appear in a
LOCAL or LOCAL_INIT locality-spec."

The changes do not implement the checking required to determine whether a
variable can appear in a "variable definition context".

Here's a summary of the changes:
 - I created the function 'PassesLocalityChecks()' to enforce C1128 along with
   C1124, C1125, and C1126.
 - I cleaned up the code to check if a type or symbol is a coarray.
 - I added functions to tools.[h,cc] to test if a symbol is OPTIONAL, INTENT
   IN, finalizable, a coarray, or an assumed size array.  Should these be
   member functions of the type "Symbol"?
 - Since I changed one of the locality related error messages, I needed to
   change the test resolve35.f90.
 - I added the test resolve55.f90 to test all of the checks implemented in this
   update.

Original-commit: flang-compiler/f18@4ca5d090b9f9a82dd06cf46028586b1c7474f845
Reviewed-on: https://github.com/flang-compiler/f18/pull/542
Tree-same-pre-rewrite: false
flang/lib/semantics/check-allocate.cc
flang/lib/semantics/resolve-names.cc
flang/lib/semantics/tools.cc
flang/lib/semantics/tools.h
flang/test/semantics/CMakeLists.txt
flang/test/semantics/resolve35.f90
flang/test/semantics/resolve55.f90 [new file with mode: 0644]