[flang-commits] [PATCH] D122406: [flang] Fix LBOUND rewrite on descriptor components

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Mar 24 08:41:52 PDT 2022


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

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).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122406

Files:
  flang/lib/Evaluate/formatting.cpp
  flang/lib/Evaluate/shape.cpp
  flang/test/Evaluate/rewrite01.f90
  flang/test/Semantics/modfile30.f90
  flang/test/Semantics/modfile33.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122406.417941.patch
Type: text/x-patch
Size: 5591 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220324/bff16c90/attachment.bin>


More information about the flang-commits mailing list