[flang-commits] [flang] [flang] Silence inappropriate error message (PR #120614)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Thu Dec 19 10:03:30 PST 2024
https://github.com/klausler created https://github.com/llvm/llvm-project/pull/120614
A recent patch added better compatibility checking for actual procedure arguments, but it has led to a few failures in the Fujitsu Fortran test suite in cases of NULL() actual arguments being associated with dummy procedure pointers. As is the case with dummy data pointers, these must always be accepted.
Fixes Fujitsu Fortran test cases 0249_0023 through 0028 and 0387_0047.
>From b36b249ac4ecfc59e7c0d8a555ed6b070a7433d7 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Thu, 19 Dec 2024 09:24:48 -0800
Subject: [PATCH] [flang] Silence inappropriate error message
A recent patch added better compatibility checking for actual
procedure arguments, but it has led to a few failures in the Fujitsu
Fortran test suite in cases of NULL() actual arguments being
associated with dummy procedure pointers. As is the case with
dummy data pointers, these must always be accepted.
Fixes Fujitsu Fortran test cases 0249_0023 through 0028 and
0387_0047.
---
flang/lib/Semantics/expression.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/flang/lib/Semantics/expression.cpp b/flang/lib/Semantics/expression.cpp
index c2eb17c1ac8e5b..4a986cb51b1b11 100644
--- a/flang/lib/Semantics/expression.cpp
+++ b/flang/lib/Semantics/expression.cpp
@@ -2536,6 +2536,15 @@ static bool CheckCompatibleArgument(bool isElemental,
return false;
},
[&](const characteristics::DummyProcedure &dummy) {
+ if ((dummy.attrs.test(
+ characteristics::DummyProcedure::Attr::Optional) ||
+ dummy.attrs.test(
+ characteristics::DummyProcedure::Attr::Pointer)) &&
+ IsBareNullPointer(expr)) {
+ // NULL() is compatible with any dummy pointer
+ // or optional dummy procedure.
+ return true;
+ }
if (!expr || !IsProcedurePointerTarget(*expr)) {
return false;
}
More information about the flang-commits
mailing list