[flang-commits] [PATCH] D150814: [flang] Don't complain about dummy subroutine under IMPLICIT NONE

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu May 18 12:33:02 PDT 2023


klausler updated this revision to Diff 523510.
klausler added a comment.

Update test.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150814/new/

https://reviews.llvm.org/D150814

Files:
  flang/lib/Semantics/resolve-names.cpp
  flang/test/Semantics/implicit13.f90


Index: flang/test/Semantics/implicit13.f90
===================================================================
--- /dev/null
+++ flang/test/Semantics/implicit13.f90
@@ -0,0 +1,9 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+!ERROR: No explicit type declared for 'func'
+!ERROR: No explicit type declared for 'obj'
+subroutine implicit_none(func, sub, obj)
+  implicit none
+  call sub ! ok
+  print *, func()
+  print *, obj
+end
Index: flang/lib/Semantics/resolve-names.cpp
===================================================================
--- flang/lib/Semantics/resolve-names.cpp
+++ flang/lib/Semantics/resolve-names.cpp
@@ -2428,6 +2428,13 @@
   if (allowForwardReference && ImplicitlyTypeForwardRef(symbol)) {
     return;
   }
+  if (const auto *entity{symbol.detailsIf<EntityDetails>()};
+      entity && entity->isDummy()) {
+    // Dummy argument, no declaration or reference; if it turns
+    // out to be a subroutine, it's fine, and if it is a function
+    // or object, it'll be caught later.
+    return;
+  }
   if (!context().HasError(symbol)) {
     Say(symbol.name(), "No explicit type declared for '%s'"_err_en_US);
     context().SetError(symbol);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150814.523510.patch
Type: text/x-patch
Size: 1178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230518/f634802b/attachment-0001.bin>


More information about the flang-commits mailing list