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
4 changes: 3 additions & 1 deletion flang/lib/Semantics/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3541,8 +3541,10 @@ void ExpressionAnalyzer::Analyze(const parser::CallStmt &callStmt) {
ProcedureDesignator *proc{std::get_if<ProcedureDesignator>(&callee->u)};
CHECK(proc);
bool isKernel{false};
bool isBindC{false};
if (const Symbol * procSym{proc->GetSymbol()}) {
const Symbol &ultimate{procSym->GetUltimate()};
isBindC = ultimate.attrs().test(semantics::Attr::BIND_C);
if (const auto *subpDetails{
ultimate.detailsIf<semantics::SubprogramDetails>()}) {
if (auto attrs{subpDetails->cudaSubprogramAttrs()}) {
Expand All @@ -3558,7 +3560,7 @@ void ExpressionAnalyzer::Analyze(const parser::CallStmt &callStmt) {
procSym->name());
}
}
if (!isKernel && !chevrons->empty()) {
if (!isKernel && !isBindC && !chevrons->empty()) {
Say("Kernel launch parameters in chevrons may not be used unless calling a kernel subroutine"_err_en_US);
}
if (CheckCall(callStmt.source, *proc, callee->arguments)) {
Expand Down
3 changes: 3 additions & 0 deletions flang/test/Semantics/cuf04.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ module m
end subroutine
subroutine boring
end subroutine
subroutine c_kernel() bind(c,name='c_kernel')
end subroutine
subroutine test
!ERROR: 'globsubr' is a kernel subroutine and must be called with kernel launch parameters in chevrons
call globsubr
!ERROR: Kernel launch parameters in chevrons may not be used unless calling a kernel subroutine
call boring<<<1,2>>>
call c_kernel<<<1,1>>>() ! ok because bind(c) subroutine
end subroutine
end module