[flang-commits] [flang] 7009b06 - [flang][cuda] Allow STOP in device context (#120625)
via flang-commits
flang-commits at lists.llvm.org
Thu Dec 19 12:41:12 PST 2024
Author: Valentin Clement (バレンタイン クレメン)
Date: 2024-12-19T12:41:09-08:00
New Revision: 7009b0699343a7eb87e77d8e13f7c70a02ebed5f
URL: https://github.com/llvm/llvm-project/commit/7009b0699343a7eb87e77d8e13f7c70a02ebed5f
DIFF: https://github.com/llvm/llvm-project/commit/7009b0699343a7eb87e77d8e13f7c70a02ebed5f.diff
LOG: [flang][cuda] Allow STOP in device context (#120625)
STOP statement is allowed in device procedure
Added:
Modified:
flang/lib/Semantics/check-cuda.cpp
flang/test/Semantics/cuf09.cuf
Removed:
################################################################################
diff --git a/flang/lib/Semantics/check-cuda.cpp b/flang/lib/Semantics/check-cuda.cpp
index bec3969c7a26b7..d497ac20e7017b 100644
--- a/flang/lib/Semantics/check-cuda.cpp
+++ b/flang/lib/Semantics/check-cuda.cpp
@@ -350,6 +350,7 @@ template <bool IsCUFKernelDo> class DeviceContextChecker {
void Check(const parser::ActionStmt &stmt, const parser::CharBlock &source) {
common::visit(
common::visitors{
+ [&](const common::Indirection<parser::StopStmt> &) { return; },
[&](const common::Indirection<parser::PrintStmt> &) {},
[&](const common::Indirection<parser::WriteStmt> &x) {
if (x.value().format) { // Formatted write to '*' or '6'
diff --git a/flang/test/Semantics/cuf09.cuf b/flang/test/Semantics/cuf09.cuf
index b45ca6d7d1a9d7..3307e2a8626729 100644
--- a/flang/test/Semantics/cuf09.cuf
+++ b/flang/test/Semantics/cuf09.cuf
@@ -49,6 +49,11 @@ module m
i = threadIdx%x
a(i) = c(10) ! ok, a is device and c is constant
end subroutine
+
+ attributes(global) subroutine stoptest()
+ print*,threadIdx%x
+ stop ! ok
+ end subroutine
end
program main
More information about the flang-commits
mailing list