[flang] Don't fold SIZE()/SHAPE() into expression referencing optional dummy arguments
authorPeter Klausler <pklausler@nvidia.com>
Thu, 25 May 2023 23:01:52 +0000 (16:01 -0700)
committerPeter Klausler <pklausler@nvidia.com>
Wed, 31 May 2023 15:57:18 +0000 (08:57 -0700)
commit71d5a94985c9569467c1ef8a62b8b326ee2036a6
treecb74bacf356c546930b3014aaaf844585c3816ec
parent660e4530124356442ff63d61b1f6dcb9c1def7e6
[flang] Don't fold SIZE()/SHAPE() into expression referencing optional dummy arguments

When computing the shape of an expression at compilation time as part of
folding an intrinsic function like SIZE(), don't create an expression that
increases a dependence on the presence of an optional dummy argument.

Differential Revision: https://reviews.llvm.org/D151737
flang/lib/Evaluate/shape.cpp
flang/test/Evaluate/elem-shape.f90 [new file with mode: 0644]