[flang-commits] [flang] [flang] Whether a procedure's interface is explicit or not is not a d… (PR #82796)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Fri Feb 23 09:20:16 PST 2024


https://github.com/klausler created https://github.com/llvm/llvm-project/pull/82796

…istinguishing characteristic

We note whether a procedure's interface is explicit or implicit as an attribute of its characteristics, so that other semantics can be checked appropriately, but this internal attribute should not be used as a distinguishing characteristic in itself.

Fixes https://github.com/llvm/llvm-project/issues/81876.

>From bd372444c0e18dc96615be9f37846413c8be1054 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Fri, 23 Feb 2024 09:16:27 -0800
Subject: [PATCH] [flang] Whether a procedure's interface is explicit or not is
 not a distinguishing characteristic

We note whether a procedure's interface is explicit or implicit as an
attribute of its characteristics, so that other semantics can be
checked appropriately, but this internal attribute should not be
used as a distinguishing characteristic in itself.

Fixes https://github.com/llvm/llvm-project/issues/81876.
---
 flang/lib/Evaluate/characteristics.cpp | 1 +
 flang/test/Semantics/call35.f90        | 2 +-
 flang/test/Semantics/null-init.f90     | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/flang/lib/Evaluate/characteristics.cpp b/flang/lib/Evaluate/characteristics.cpp
index 80b0f346c32d38..cf8b16c0ead6cd 100644
--- a/flang/lib/Evaluate/characteristics.cpp
+++ b/flang/lib/Evaluate/characteristics.cpp
@@ -1265,6 +1265,7 @@ bool Procedure::IsCompatibleWith(const Procedure &actual, std::string *whyNot,
   }
   Attrs differences{attrs ^ actualAttrs};
   differences.reset(Attr::Subroutine); // dealt with specifically later
+  differences.reset(Attr::ImplicitInterface);
   if (!differences.empty()) {
     if (whyNot) {
       auto sep{": "s};
diff --git a/flang/test/Semantics/call35.f90 b/flang/test/Semantics/call35.f90
index ff819481226d62..81a0ecb04da536 100644
--- a/flang/test/Semantics/call35.f90
+++ b/flang/test/Semantics/call35.f90
@@ -12,7 +12,7 @@ subroutine s2
 
 subroutine s3
   interface
-    !WARNING: The global subprogram 'ext' is not compatible with its local procedure declaration (incompatible procedure attributes: ImplicitInterface)
+    !WARNING: The global subprogram 'ext' is not compatible with its local procedure declaration (distinct numbers of dummy arguments)
     subroutine ext(n)
       integer n
     end
diff --git a/flang/test/Semantics/null-init.f90 b/flang/test/Semantics/null-init.f90
index ad3f91679a4272..ad2fa511f9ff3f 100644
--- a/flang/test/Semantics/null-init.f90
+++ b/flang/test/Semantics/null-init.f90
@@ -37,7 +37,7 @@ module m6
 
 module m7
   interface
-    !WARNING: The external interface 'null' is not compatible with an earlier definition (incompatible procedure attributes: ImplicitInterface)
+    !WARNING: The external interface 'null' is not compatible with an earlier definition (function results have incompatible attributes)
     function null() result(p)
       integer, pointer :: p
     end function



More information about the flang-commits mailing list