[PATCH] D99892: [flang] Improve constant folding for type parameter inquiries

Pete Steinfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 5 11:14:03 PDT 2021


PeteSteinfeld created this revision.
PeteSteinfeld added reviewers: klausler, tskeith.
PeteSteinfeld requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

We were not folding type parameter inquiries for the form 'var%typeParam'
where 'typeParam' was a KIND or LEN type parameter of a derived type and 'var'
was a designator of the derived type.  I fixed this by adding code to the
function 'FoldOperation()' for 'TypeParamInquiry's to handle this case.  I also
cleaned up the code for the case where there is no designator.

In order to make the error messages correctly refer to both the points of
declaration and instantiation, I needed to add an argument to the function
'InstantiateIntrinsicType()' for the location of the instantiation.

I also changed the formatting of 'TypeParamInquiry' to correctly format this
case.  I also added tests for both KIND and LEN type parameter inquiries in
resolve104.f90.

Making these changes revealed an error in resolve89.f90 and caused one of the
error messages in assign04.f90 to be different.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99892

Files:
  flang/lib/Evaluate/fold-integer.cpp
  flang/lib/Evaluate/formatting.cpp
  flang/lib/Semantics/type.cpp
  flang/test/Semantics/assign04.f90
  flang/test/Semantics/resolve104.f90
  flang/test/Semantics/resolve89.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99892.335299.patch
Type: text/x-patch
Size: 8658 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210405/b50b5a23/attachment-0001.bin>


More information about the llvm-commits mailing list