[flang-commits] [flang] f19af90 - [flang][cuda] Remove check for obsolete constraint (#70707)

via flang-commits flang-commits at lists.llvm.org
Tue Oct 31 12:39:21 PDT 2023


Author: Peter Klausler
Date: 2023-10-31T12:39:18-07:00
New Revision: f19af90cf88246d42ce1f2310ded70895e0835b8

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

LOG: [flang][cuda] Remove check for obsolete constraint (#70707)

The online CUDA Fortran documentation states that a device subprogram
must be a top-level module subprogram, but this has turned out to be an
obsolete constraint. Stop enforcing it.

Added: 
    

Modified: 
    flang/lib/Semantics/check-declarations.cpp
    flang/test/Semantics/cuf02.cuf

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp
index 3626aaf3f44924d..fdd29f081324c77 100644
--- a/flang/lib/Semantics/check-declarations.cpp
+++ b/flang/lib/Semantics/check-declarations.cpp
@@ -1394,12 +1394,6 @@ void CheckHelper::CheckSubprogram(
     if (ClassifyProcedure(symbol) == ProcedureDefinitionClass::Internal) {
       messages_.Say(symbol.name(),
           "A device subprogram may not be an internal subprogram"_err_en_US);
-    } else if ((*cudaAttrs == common::CUDASubprogramAttrs::Device ||
-                   *cudaAttrs == common::CUDASubprogramAttrs::HostDevice) &&
-        (symbol.owner().kind() != Scope::Kind::Module ||
-            details.isInterface())) {
-      messages_.Say(symbol.name(),
-          "An ATTRIBUTES(DEVICE) subprogram must be a top-level module procedure"_err_en_US);
     }
   }
   if ((!details.cudaLaunchBounds().empty() ||

diff  --git a/flang/test/Semantics/cuf02.cuf b/flang/test/Semantics/cuf02.cuf
index 38b3e783d86b3a4..881a3005e2817bd 100644
--- a/flang/test/Semantics/cuf02.cuf
+++ b/flang/test/Semantics/cuf02.cuf
@@ -1,7 +1,6 @@
 ! RUN: %python %S/test_errors.py %s %flang_fc1
 module m
   interface
-    !ERROR: An ATTRIBUTES(DEVICE) subprogram must be a top-level module procedure
     attributes(device) subroutine exts1
     end
   end interface
@@ -44,6 +43,5 @@ module m
   end
 end
 
-!ERROR: An ATTRIBUTES(DEVICE) subprogram must be a top-level module procedure
 attributes(device) subroutine exts1
 end


        


More information about the flang-commits mailing list