[all-commits] [llvm/llvm-project] e03664: [flang] Fix parsing and semantics for array elemen...

Peter Klausler via All-commits all-commits at lists.llvm.org
Fri Jul 22 16:55:04 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e03664d40c707017dc5bab16be19d6939b5719d2
      https://github.com/llvm/llvm-project/commit/e03664d40c707017dc5bab16be19d6939b5719d2
  Author: Peter Klausler <pklausler at nvidia.com>
  Date:   2022-07-22 (Fri, 22 Jul 2022)

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

  Log Message:
  -----------
  [flang] Fix parsing and semantics for array element substring%KIND/%LEN

A type-param-inquiry of %KIND or %LEN applies to a designator, and
so must also be allowed for a substring.  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.

Differential Revision: https://reviews.llvm.org/D130375




More information about the All-commits mailing list