[flang-commits] [PATCH] D130375: [flang] Fix parsing and semantics for array element substring%KIND/%LEN

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Jul 22 11:59:11 PDT 2022


klausler created this revision.
klausler added a reviewer: PeteSteinfeld.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a reviewer: sscalpone.
Herald added a project: All.
klausler requested review of this revision.

A type-param-inquiry of %KIND or %LEN applies to a designator, and
so must also be allowed for a substring.  F18 <https://reviews.llvm.org/F18> presently (mis)parses
instances of a type-param-inquiry as structure component references
and then fixes them in expression semantics when types are known and
we can distinguish them.  But when the base of a type-param-inquiry is
a substring of an array element, as in "charArray(i)(j:k)%len",
parsing fails.

Adjust the grammar to parse these cases, and extend expression semantics
to process the new production.


https://reviews.llvm.org/D130375

Files:
  flang/include/flang/Parser/dump-parse-tree.h
  flang/include/flang/Parser/parse-tree.h
  flang/include/flang/Semantics/expression.h
  flang/lib/Parser/Fortran-parsers.cpp
  flang/lib/Parser/expr-parsers.cpp
  flang/lib/Parser/unparse.cpp
  flang/lib/Semantics/expression.cpp
  flang/lib/Semantics/resolve-names.cpp
  flang/test/Evaluate/rewrite02.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130375.446922.patch
Type: text/x-patch
Size: 14258 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220722/6f1496ff/attachment.bin>


More information about the flang-commits mailing list