File tree 2 files changed +20
-7
lines changed 2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -487,13 +487,15 @@ static void getDeclareTargetInfo(
487
487
} else if (const auto *clauseList{
488
488
parser::Unwrap<parser::OmpClauseList>(spec.u )}) {
489
489
List<Clause> clauses = makeClauses (*clauseList, semaCtx);
490
- if (clauses.empty () &&
491
- (!eval.getOwningProcedure ()->isMainProgram () ||
492
- eval.getOwningProcedure ()->getMainProgramSymbol ())) {
493
- // Case: declare target, implicit capture of function
494
- symbolAndClause.emplace_back (
495
- mlir::omp::DeclareTargetCaptureClause::to,
496
- eval.getOwningProcedure ()->getSubprogramSymbol ());
490
+ if (clauses.empty ()) {
491
+ Fortran::lower::pft::FunctionLikeUnit *owningProc =
492
+ eval.getOwningProcedure ();
493
+ if (owningProc && (!owningProc->isMainProgram () ||
494
+ owningProc->getMainProgramSymbol ())) {
495
+ // Case: declare target, implicit capture of function
496
+ symbolAndClause.emplace_back (mlir::omp::DeclareTargetCaptureClause::to,
497
+ owningProc->getSubprogramSymbol ());
498
+ }
497
499
}
498
500
499
501
ClauseProcessor cp (converter, semaCtx, clauses);
Original file line number Diff line number Diff line change
1
+ ! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
2
+ ! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-is-device %s -o - | FileCheck %s
3
+
4
+ ! CHECK: module attributes
5
+ module iface
6
+ interface
7
+ subroutine a ()
8
+ ! $omp declare target
9
+ end subroutine
10
+ end interface
11
+ end module
You can’t perform that action at this time.
0 commit comments