Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion flang/lib/Semantics/check-cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,8 @@ void CUDAChecker::Enter(const parser::AssignmentStmt &x) {
void CUDAChecker::Enter(const parser::PrintStmt &x) {
CHECK(context_.location());
const Scope &scope{context_.FindScope(*context_.location())};
if (IsCUDADeviceContext(&scope) || deviceConstructDepth_ > 0) {
const Scope &progUnit{GetProgramUnitContaining(scope)};
if (IsCUDADeviceContext(&progUnit) || deviceConstructDepth_ > 0) {
return;
}

Expand Down
7 changes: 7 additions & 0 deletions flang/test/Semantics/cuf23.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@ attributes(device) subroutine device1()
real, device :: a(10)
print*, a ! ok
end subroutine

attributes(global) subroutine global_with_block()
block
real, device :: a(10)
print*, a ! ok
end block
end subroutine