Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/flang
diff options
context:
space:
mode:
authorPeter Klausler <pklausler@nvidia.com>2022-05-09 19:37:35 +0300
committerPeter Klausler <pklausler@nvidia.com>2022-05-11 20:33:17 +0300
commitd80d812df0c829b6dbbcb968e7c3cf3c6be6ff41 (patch)
tree8c6fd0c47617cca38f5db9a448c9ae4923f495be /flang
parent987362342597df266df6b5ac871c9ca19b064795 (diff)
[flang] Fix check for assumed-size arguments to SHAPE() & al.
The predicate that is used to detect an invalid assumed-size argument to the intrinsic functions SHAPE, SIZE, & LBOUND gives false results for arguments whose shapes are not calculatable at compilation time. Replace with an explicit test for an assumed-size array dummy argument symbol. Differential Revision: https://reviews.llvm.org/D125342
Diffstat (limited to 'flang')
-rw-r--r--flang/lib/Evaluate/intrinsics.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp
index c65825abb1aa..64aafe5e5083 100644
--- a/flang/lib/Evaluate/intrinsics.cpp
+++ b/flang/lib/Evaluate/intrinsics.cpp
@@ -1563,8 +1563,8 @@ std::optional<SpecificCall> IntrinsicInterface::Match(
// (A previous error message for UBOUND will take precedence
// over this one, as this error is caught by the second entry
// for UBOUND.)
- if (std::optional<Shape> shape{GetShape(context, *arg)}) {
- if (!shape->empty() && !shape->back().has_value()) {
+ if (const Symbol * argSym{GetLastSymbol(*arg)}) {
+ if (semantics::IsAssumedSizeArray(*argSym)) {
if (strcmp(name, "shape") == 0) {
messages.Say(arg->sourceLocation(),
"The '%s=' argument to the intrinsic function '%s' may not be assumed-size"_err_en_US,