Skip to content

Commit 4eaae62

Browse files
committed
Add check for cuf kernel loop number exceeding do concurrent index range
1 parent 1ee5f69 commit 4eaae62

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

flang/lib/Semantics/check-cuda.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,19 @@ static int DoConstructTightNesting(
525525
return 0;
526526
}
527527
innerBlock = &std::get<parser::Block>(doConstruct->t);
528+
if (doConstruct->IsDoConcurrent()) {
529+
const auto &loopControl = doConstruct->GetLoopControl();
530+
if (loopControl) {
531+
if (const auto *concurrentControl{
532+
std::get_if<parser::LoopControl::Concurrent>(&loopControl->u)}) { const auto &concurrentHeader =
533+
std::get<Fortran::parser::ConcurrentHeader>(concurrentControl->t); const auto &controls =
534+
std::get<std::list<Fortran::parser::ConcurrentControl>>(
535+
concurrentHeader.t);
536+
return controls.size();
537+
}
538+
}
539+
return 0;
540+
}
528541
if (innerBlock->size() == 1) {
529542
if (const auto *execConstruct{
530543
std::get_if<parser::ExecutableConstruct>(&innerBlock->front().u)}) {

0 commit comments

Comments
 (0)