Skip to content

Commit

Permalink
[flang][cuda] Allow STOP in device context (#120625)
Browse files Browse the repository at this point in the history
STOP statement is allowed in device procedure
  • Loading branch information
clementval authored Dec 19, 2024
1 parent 6e7312b commit 7009b06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions flang/lib/Semantics/check-cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
5 changes: 5 additions & 0 deletions flang/test/Semantics/cuf09.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7009b06

Please sign in to comment.