[flang-commits] [PATCH] D111832: [flang] Expunge bogus semantic check for ELEMENTAL without dummies

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Oct 14 13:20:46 PDT 2021


klausler created this revision.
klausler added a reviewer: PeteSteinfeld.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
klausler requested review of this revision.

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.


https://reviews.llvm.org/D111832

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


Index: flang/test/Semantics/elemental01.f90
===================================================================
--- flang/test/Semantics/elemental01.f90
+++ 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
Index: flang/lib/Semantics/check-declarations.cpp
===================================================================
--- flang/lib/Semantics/check-declarations.cpp
+++ flang/lib/Semantics/check-declarations.cpp
@@ -899,9 +899,6 @@
     // 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111832.379816.patch
Type: text/x-patch
Size: 1239 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20211014/bd442e47/attachment.bin>


More information about the flang-commits mailing list