[all-commits] [llvm/llvm-project] ca4744: [flang] Don't reference non-invariant symbols in s...
Peter Klausler via All-commits
all-commits at lists.llvm.org
Mon Nov 8 12:49:02 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ca47447952f1f8b0de11aac75b45f83f88579b80
https://github.com/llvm/llvm-project/commit/ca47447952f1f8b0de11aac75b45f83f88579b80
Author: Peter Klausler <pklausler at nvidia.com>
Date: 2021-11-08 (Mon, 08 Nov 2021)
Changed paths:
M flang/include/flang/Evaluate/check-expression.h
M flang/lib/Evaluate/check-expression.cpp
M flang/lib/Evaluate/shape.cpp
M flang/test/Semantics/modfile33.f90
M flang/test/Semantics/offsets01.f90
Log Message:
-----------
[flang] Don't reference non-invariant symbols in shape expressions
When an array's shape involves references to symbols that are not
invariant in a scope -- the classic example being a dummy array
with an explicit shape involving other dummy arguments -- the
compiler was creating shape expressions that referenced those
symbols. This might be valid if those symbols are somehow
captured and copied at each entry point to a subprogram, and
the copies referenced in the shapes instead, but that's not
the case.
This patch introduces a new expression predicate IsScopeInvariantExpr(),
which defines a class of expressions that contains constant expressions
(in the sense that the standard uses that term) as well as references
to items that may be safely accessed in a context-free way throughout
their scopes. This includes dummy arguments that are INTENT(IN)
and not VALUE, descriptor inquiries into descriptors that cannot
change, and bare LEN type parameters within the definitions of
derived types. The new predicate is then used in shape analysis
to winnow out results that would have otherwise been contextual.
Differential Revision: https://reviews.llvm.org/D113309
More information about the All-commits
mailing list