[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 14:03:52 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc32d5458b50f: [flang] Don't complain about dummy subroutine under IMPLICIT NONE (authored by klausler).
Repository:
rG LLVM Github Monorepo
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.523550.patch
Type: text/x-patch
Size: 1178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230518/8be59f87/attachment-0001.bin>
More information about the flang-commits
mailing list