Skip to content

Commit 0182325

Browse files
committed
edit error mmessage
1 parent 809cebe commit 0182325

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

flang/lib/Semantics/check-cuda.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,14 @@ void CUDAChecker::Enter(const parser::CUFKernelDoConstruct &x) {
613613
std::get<std::optional<parser::DoConstruct>>(x.t))};
614614
const parser::Block *innerBlock{nullptr};
615615
if (DoConstructTightNesting(doConstruct, innerBlock) < depth) {
616-
context_.Say(source,
617-
"!$CUF KERNEL DO (%jd) must be followed by a DO construct with tightly nested outer levels of counted DO loops"_err_en_US,
618-
std::intmax_t{depth});
616+
if (doConstruct && doConstruct->IsDoConcurrent())
617+
context_.Say(source,
618+
"!$CUF KERNEL DO (%jd) must be followed by a DO CONCURRENT construct with at least %jd indices"_err_en_US,
619+
std::intmax_t{depth}, std::intmax_t{depth});
620+
else
621+
context_.Say(source,
622+
"!$CUF KERNEL DO (%jd) must be followed by a DO construct with tightly nested outer levels of counted DO loops"_err_en_US,
623+
std::intmax_t{depth});
619624
}
620625
if (innerBlock) {
621626
DeviceContextChecker<true>{context_}.Check(*innerBlock);

flang/test/Semantics/cuf09.cuf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ program main
133133
!$cuf kernel do <<< 1, 2 >>>
134134
do concurrent (j=1:10)
135135
end do
136-
!ERROR: !$CUF KERNEL DO (2) must be followed by a DO construct with tightly nested outer levels of counted DO loops
136+
!ERROR: !$CUF KERNEL DO (2) must be followed by a DO CONCURRENT construct with at least 2 indices
137137
!$cuf kernel do(2) <<< 1, 2 >>>
138138
do concurrent (j=1:10)
139139
end do

0 commit comments

Comments
 (0)