[PATCH] D79263: [flang] New implementation for checks for constraints C741 through C750

Pete Steinfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 1 17:17:20 PDT 2020


PeteSteinfeld created this revision.
PeteSteinfeld added a reviewer: tskeith.
Herald added subscribers: llvm-commits, jfb.
Herald added a reviewer: DavidTruby.
Herald added a reviewer: sscalpone.
Herald added a project: LLVM.
PeteSteinfeld added a project: Flang.
Herald added a reviewer: jdoerfert.

Most of this was previously in review in D78160 <https://reviews.llvm.org/D78160>.  Since that last review, I
added an enumeration to distinguish between specification expressions for
component bounds and for type parameters.  I then changed the code to pass an
enumeration value to "CheckSpecificationExpr()" to indicate that the expression
was a bounds expression and used this value to determine whether to emit an
error message when violations of C750 are found.

Here's the information about the overall changes in the previous review:

Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.

I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.

I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.

I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array. C750 prohibits
specification functions, the intrinsic functions ALLOCATED, ASSOCIATED,
EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It also requires every
specification inquiry reference to be a constant expression, and requires that
the value of the bound not depend on the value of a variable.  To do this, I
added code to the intrinsic proc table to get the intrinsic class of a
procedure.

I changed the implementation of IsPureProcedure() to handle statement functions
and changed some references in the code that tested for the PURE attribute to
call IsPureProcedure().

I also fixed some unrelated tests that got new errors when I implemented these
new checks.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79263

Files:
  flang/include/flang/Evaluate/check-expression.h
  flang/include/flang/Evaluate/intrinsics.h
  flang/lib/Evaluate/check-expression.cpp
  flang/lib/Evaluate/intrinsics.cpp
  flang/lib/Semantics/check-declarations.cpp
  flang/lib/Semantics/expression.cpp
  flang/lib/Semantics/resolve-names.cpp
  flang/lib/Semantics/tools.cpp
  flang/test/Semantics/allocate11.f90
  flang/test/Semantics/call12.f90
  flang/test/Semantics/call14.f90
  flang/test/Semantics/misc-declarations.f90
  flang/test/Semantics/modfile24.f90
  flang/test/Semantics/resolve33.f90
  flang/test/Semantics/resolve44.f90
  flang/test/Semantics/resolve88.f90
  flang/test/Semantics/resolve89.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79263.261534.patch
Type: text/x-patch
Size: 62470 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200502/00cfe9e8/attachment-0001.bin>


More information about the llvm-commits mailing list