Skip to content

Commit 7009b06

Browse files
authored
[flang][cuda] Allow STOP in device context (#120625)
STOP statement is allowed in device procedure
1 parent 6e7312b commit 7009b06

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

flang/lib/Semantics/check-cuda.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ template <bool IsCUFKernelDo> class DeviceContextChecker {
350350
void Check(const parser::ActionStmt &stmt, const parser::CharBlock &source) {
351351
common::visit(
352352
common::visitors{
353+
[&](const common::Indirection<parser::StopStmt> &) { return; },
353354
[&](const common::Indirection<parser::PrintStmt> &) {},
354355
[&](const common::Indirection<parser::WriteStmt> &x) {
355356
if (x.value().format) { // Formatted write to '*' or '6'

flang/test/Semantics/cuf09.cuf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ module m
4949
i = threadIdx%x
5050
a(i) = c(10) ! ok, a is device and c is constant
5151
end subroutine
52+
53+
attributes(global) subroutine stoptest()
54+
print*,threadIdx%x
55+
stop ! ok
56+
end subroutine
5257
end
5358

5459
program main

0 commit comments

Comments
 (0)