[all-commits] [llvm/llvm-project] 7f1adb: [flang] Fix LBOUND rewrite on descriptor components

jeanPerier via All-commits all-commits at lists.llvm.org
Fri Mar 25 01:02:34 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7f1adbaba99512d5fbf45ec54585b41218535836
      https://github.com/llvm/llvm-project/commit/7f1adbaba99512d5fbf45ec54585b41218535836
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2022-03-25 (Fri, 25 Mar 2022)

  Changed paths:
    M flang/lib/Evaluate/formatting.cpp
    M flang/lib/Evaluate/shape.cpp
    M flang/test/Evaluate/rewrite01.f90
    M flang/test/Semantics/modfile30.f90
    M flang/test/Semantics/modfile33.f90

  Log Message:
  -----------
  [flang] Fix LBOUND rewrite on descriptor components

GetLowerBoundHelper rewrite in https://reviews.llvm.org/D121488 was
incorrect with POINTER/ALLOCATABLE components. The rewrite created a
descriptor inquiry to the component symbol only instead of the whole
named entity. The base information was lost, and not retrievable.
LBOUND(a(10)%p) became LBOUND(p).

Fix this regression, and also update DescriptorInquiry unparsing to
carry the kind information. DescriptorInquiries are KIND 8 expressions,
while LBOUND/SIZE/RANK, %LEN are default kind expressions.
This caused `print *,lbound(x,kind=8)` to unparse as `print*,lbound(x)` which is not
semantically the same (this unparsing issue was not an issue for
lowering, but I noticed it while writing my regression test).

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




More information about the All-commits mailing list