[flang-commits] [flang] [flang][cuda] Remove check for obsolete constraint (PR #70707)
via flang-commits
flang-commits at lists.llvm.org
Mon Oct 30 11:57:38 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-semantics
Author: Peter Klausler (klausler)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/70707.diff
2 Files Affected:
- (modified) flang/lib/Semantics/check-declarations.cpp (-6)
- (modified) flang/test/Semantics/cuf02.cuf (-2)
``````````diff
diff --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp
index 2c2866d590ae5a4..32583643dc0f2e9 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
``````````
</details>
https://github.com/llvm/llvm-project/pull/70707
More information about the flang-commits
mailing list