[flang-commits] [flang] bd72ed9 - [flang] CHARACTER(*) return does not require explicit interface

Jean Perier via flang-commits flang-commits at lists.llvm.org
Wed Sep 23 04:38:58 PDT 2020


Author: Jean Perier
Date: 2020-09-23T13:38:10+02:00
New Revision: bd72ed93d22a1579362859e64a0c7f9c68460cf8

URL: https://github.com/llvm/llvm-project/commit/bd72ed93d22a1579362859e64a0c7f9c68460cf8
DIFF: https://github.com/llvm/llvm-project/commit/bd72ed93d22a1579362859e64a0c7f9c68460cf8.diff

LOG: [flang] CHARACTER(*) return does not require explicit interface

Fortran 2018 15.4.2.2(4)(c) says nonassumed or explicit non-constant
length parameter require explicit interface. The "nonassumed" part was
missing in f18 characteristic analysis causing CanBeCalledViaImplicitInterface
to return false for `CHARACTER(*) function foo()` like interfaces.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D88075

Added: 
    

Modified: 
    flang/lib/Evaluate/characteristics.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Evaluate/characteristics.cpp b/flang/lib/Evaluate/characteristics.cpp
index 9d301b6abccc..de013367f6aa 100644
--- a/flang/lib/Evaluate/characteristics.cpp
+++ b/flang/lib/Evaluate/characteristics.cpp
@@ -485,6 +485,8 @@ bool FunctionResult::CanBeReturnedViaImplicitInterface() const {
         if (const auto *param{type.charLength()}) {
           if (const auto &expr{param->GetExplicit()}) {
             return IsConstantExpr(*expr); // 15.4.2.2(4)(c)
+          } else if (param->isAssumed()) {
+            return true;
           }
         }
         return false;


        


More information about the flang-commits mailing list