[flang-commits] [flang] 1062f98 - [flang] Expunge bogus semantic check for ELEMENTAL without dummies

peter klausler via flang-commits flang-commits at lists.llvm.org
Thu Oct 14 14:33:37 PDT 2021


Author: peter klausler
Date: 2021-10-14T14:33:30-07:00
New Revision: 1062f989af23c52a472892ff54a55557fca35528

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

LOG: [flang] Expunge bogus semantic check for ELEMENTAL without dummies

Semantics refuses valid ELEMENTAL subprograms without dummy arguments,
but there's no such constraint in the standard; indeed, subclause
15.8.2 discusses the meaning of calls to ELEMENTAL functions with
arguments.  Remove the check and its test.

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

Added: 
    

Modified: 
    flang/lib/Semantics/check-declarations.cpp
    flang/test/Semantics/elemental01.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp
index 2ff39ee2b812b..21ca312acebb5 100644
--- a/flang/lib/Semantics/check-declarations.cpp
+++ b/flang/lib/Semantics/check-declarations.cpp
@@ -899,9 +899,6 @@ void CheckHelper::CheckSubprogram(
     // See comment on the similar check in CheckProcEntity()
     if (details.isDummy()) {
       messages_.Say("A dummy procedure may not be ELEMENTAL"_err_en_US);
-    } else if (details.dummyArgs().empty()) {
-      messages_.Say(
-          "An ELEMENTAL subprogram must have at least one dummy argument"_err_en_US);
     } else {
       for (const Symbol *dummy : details.dummyArgs()) {
         if (!dummy) { // C15100

diff  --git a/flang/test/Semantics/elemental01.f90 b/flang/test/Semantics/elemental01.f90
index 24847760cd6eb..8a80727da45ef 100644
--- a/flang/test/Semantics/elemental01.f90
+++ b/flang/test/Semantics/elemental01.f90
@@ -1,11 +1,6 @@
 ! RUN: %python %S/test_errors.py %s %flang_fc1
 ! Tests ELEMENTAL subprogram constraints C15100-15102
 
-!ERROR: An ELEMENTAL subprogram must have at least one dummy argument
-elemental integer function noargs
-  noargs = 1
-end function
-
 !ERROR: An ELEMENTAL subroutine may not have an alternate return dummy argument
 elemental subroutine altret(*)
 end subroutine


        


More information about the flang-commits mailing list