[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 13:27:41 PDT 2021
PeteSteinfeld added a comment.
Yes, the value of the type parameter is derived from the associated object at the time that the object is instantiated. I believe that the current code is folding the value of the type parameter from the instantiated value. Here's a modified version of your example that illustrates that:
subroutine foo(n)
type :: t(len)
integer, len :: len
end type t
type(t(n)) :: x1
real(x1%len) :: r1 ! Error since the KIND of r1 isn't constant
type(t(4)) :: x2
real(x2%len) :: r2
block
real(x2%len) :: r3 ! OK, the KIND of r3 is x2%len, which is folded to 4
end block
n = 99
block
real(x2%len) :: r4 ! Still OK, because the x2%len gets folded to 4
end block
end
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99892/new/
https://reviews.llvm.org/D99892
More information about the llvm-commits
mailing list