[flang-commits] [flang] 0d454e8 - [flang] Fix bug detecting intrinsic function

Tim Keith via flang-commits flang-commits at lists.llvm.org
Mon Aug 3 12:22:12 PDT 2020


Author: Tim Keith
Date: 2020-08-03T12:21:59-07:00
New Revision: 0d454e8e087049ae86283e73a25cf8eaad488651

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

LOG: [flang] Fix bug detecting intrinsic function

Don't set the INTRINSIC attribute on a dummy procedure.

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

Added: 
    

Modified: 
    flang/lib/Semantics/resolve-names.cpp
    flang/test/Semantics/symbol18.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index e85dfa9c91ef..c5b42473d011 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -5749,7 +5749,8 @@ void ResolveNamesVisitor::HandleProcedureName(
     // error was reported
   } else {
     symbol = &Resolve(name, symbol)->GetUltimate();
-    if (ConvertToProcEntity(*symbol) && IsIntrinsic(symbol->name())) {
+    if (ConvertToProcEntity(*symbol) && IsIntrinsic(symbol->name()) &&
+        !IsDummy(*symbol)) {
       symbol->attrs().set(Attr::INTRINSIC);
       // 8.2(3): ignore type from intrinsic in type-declaration-stmt
       symbol->get<ProcEntityDetails>().set_interface(ProcInterface{});

diff  --git a/flang/test/Semantics/symbol18.f90 b/flang/test/Semantics/symbol18.f90
index b7269b70be0a..93987f6741ed 100644
--- a/flang/test/Semantics/symbol18.f90
+++ b/flang/test/Semantics/symbol18.f90
@@ -19,3 +19,13 @@ program p1
  !REF: /p1/x
  y = f(x)
 end program
+
+!DEF: /f2 (Function) Subprogram REAL(4)
+!DEF: /f2/cos EXTERNAL (Function, Implicit) ProcEntity REAL(4)
+!DEF: /f2/x (Implicit) ObjectEntity REAL(4)
+function f2(cos, x)
+ !DEF: /f2/f2 (Implicit) ObjectEntity REAL(4)
+ !REF: /f2/cos
+ !REF: /f2/x
+ f2 = cos(x)
+end function


        


More information about the flang-commits mailing list