[flang] Support PDT declaration with initial comp value in internal procedure
authorJean Perier <jperier@nvidia.com>
Tue, 14 Jun 2022 12:32:39 +0000 (14:32 +0200)
committerJean Perier <jperier@nvidia.com>
Tue, 14 Jun 2022 12:46:12 +0000 (14:46 +0200)
commitac64c7b987f15bcce09b616c1ee0deaf2b7b587e
tree1fba3c42fd7bc1b1f48e185a4c807b13b7b5299f
parent7625e01d661644a560884057755d48a0da8b77b4
[flang] Support PDT declaration with initial comp value in internal procedure

Lowering was crashing with "fatal internal error: node has not been analyzed"
if a PDT with initial component value was defined inside an internal
procedure. This is because the related expression cannot be analyzed
without the component values (which happens at the instatiation).
These expression do not need to be visited (the instantiations, if any
will be). Use the form of GetExpr that tolerates the parse tree expression
to not be analyzed into an evaluate::Expr when looking through the
symbols used in an internal procedure.

Note that the PDTs TODO will then fire (it happens after the PFT
analysis) as expected if the derived type is used.

Differential Revision: https://reviews.llvm.org/D127735
flang/lib/Lower/PFTBuilder.cpp
flang/test/Lower/host-associated.f90