[all-commits] [llvm/llvm-project] 8d0c3c: [flang] New implementation for checks for constrai...
Pete Steinfeld via All-commits
all-commits at lists.llvm.org
Tue May 5 09:38:21 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 8d0c3c05f2f4b9e827eff98b7a375d174a163570
https://github.com/llvm/llvm-project/commit/8d0c3c05f2f4b9e827eff98b7a375d174a163570
Author: Pete Steinfeld <psteinfeld at nvidia.com>
Date: 2020-05-05 (Tue, 05 May 2020)
Changed paths:
M flang/include/flang/Evaluate/check-expression.h
M flang/include/flang/Evaluate/intrinsics.h
M flang/lib/Evaluate/check-expression.cpp
M flang/lib/Evaluate/intrinsics.cpp
M flang/lib/Semantics/check-declarations.cpp
M flang/lib/Semantics/expression.cpp
M flang/lib/Semantics/resolve-names.cpp
M flang/lib/Semantics/tools.cpp
M flang/test/Semantics/allocate11.f90
M flang/test/Semantics/call12.f90
M flang/test/Semantics/call14.f90
M flang/test/Semantics/misc-declarations.f90
M flang/test/Semantics/modfile24.f90
M flang/test/Semantics/resolve33.f90
M flang/test/Semantics/resolve44.f90
A flang/test/Semantics/resolve88.f90
A flang/test/Semantics/resolve89.f90
Log Message:
-----------
[flang] New implementation for checks for constraints C741 through C750
Summary:
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.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
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 implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus 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.
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.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
More information about the All-commits
mailing list