[flang-commits] [flang] c1a0240 - [flang] Emit error about missing interface when needed

peter klausler via flang-commits flang-commits at lists.llvm.org
Thu Jun 3 15:20:04 PDT 2021


Author: peter klausler
Date: 2021-06-03T15:19:54-07:00
New Revision: c1a024053d3b80a62bd65971fe9ac09539dea5ae

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

LOG: [flang] Emit error about missing interface when needed

When a procedure pointer with no interface is called by a
function reference, complain about the lack.

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

Added: 
    

Modified: 
    flang/lib/Semantics/expression.cpp
    flang/test/Semantics/resolve09.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/expression.cpp b/flang/lib/Semantics/expression.cpp
index 373c97ea9e05..33a1b0c72c61 100644
--- a/flang/lib/Semantics/expression.cpp
+++ b/flang/lib/Semantics/expression.cpp
@@ -3000,6 +3000,8 @@ MaybeExpr ExpressionAnalyzer::MakeFunctionRef(parser::CharBlock callSite,
             DEREF(result.GetTypeAndShape()).type(),
             ProcedureRef{std::move(proc), std::move(arguments)});
       }
+    } else {
+      Say("Function result characteristics are not known"_err_en_US);
     }
   }
   return std::nullopt;

diff  --git a/flang/test/Semantics/resolve09.f90 b/flang/test/Semantics/resolve09.f90
index 93b9781879d9..acb9df475971 100644
--- a/flang/test/Semantics/resolve09.f90
+++ b/flang/test/Semantics/resolve09.f90
@@ -18,6 +18,7 @@ subroutine s
   !ERROR: Cannot call function 'f' like a subroutine
   call f
   !ERROR: Cannot call subroutine 's' like a function
+  !ERROR: Function result characteristics are not known
   i = s()
 contains
   function f()


        


More information about the flang-commits mailing list