File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -592,15 +592,28 @@ void AccStructureChecker::Enter(const parser::AccClause::Gang &g) {
592
592
if (g.v ) {
593
593
bool hasNum = false ;
594
594
bool hasDim = false ;
595
+ bool hasStatic = false ;
595
596
const Fortran::parser::AccGangArgList &x = *g.v ;
596
597
for (const Fortran::parser::AccGangArg &gangArg : x.v ) {
597
598
if (std::get_if<Fortran::parser::AccGangArg::Num>(&gangArg.u )) {
598
599
hasNum = true ;
599
600
} else if (std::get_if<Fortran::parser::AccGangArg::Dim>(&gangArg.u )) {
600
601
hasDim = true ;
602
+ } else if (std::get_if<Fortran::parser::AccGangArg::Static>(&gangArg.u )) {
603
+ hasStatic = true ;
601
604
}
602
605
}
603
606
607
+ if (GetContext ().directive == llvm::acc::Directive::ACCD_routine &&
608
+ (hasStatic || hasNum)) {
609
+ context_.Say (GetContext ().clauseSource ,
610
+ " Only the dim argument is allowed on the %s clause on the %s directive" _err_en_US,
611
+ parser::ToUpperCaseLetters (
612
+ llvm::acc::getOpenACCClauseName (llvm::acc::Clause::ACCC_gang)
613
+ .str ()),
614
+ ContextDirectiveAsFortran ());
615
+ }
616
+
604
617
if (hasDim && hasNum) {
605
618
context_.Say (GetContext ().clauseSource ,
606
619
" The num argument is not allowed when dim is specified" _err_en_US);
Original file line number Diff line number Diff line change @@ -14,6 +14,16 @@ subroutine sub3()
14
14
! $acc routine bind(sub1)
15
15
end subroutine
16
16
17
+ subroutine sub4 ()
18
+ ! ERROR: Only the dim argument is allowed on the GANG clause on the ROUTINE directive
19
+ ! $acc routine gang(num: 1)
20
+ end subroutine
21
+
22
+ subroutine sub5 ()
23
+ ! ERROR: Only the dim argument is allowed on the GANG clause on the ROUTINE directive
24
+ ! $acc routine gang(static: 1)
25
+ end subroutine
26
+
17
27
subroutine sub6 ()
18
28
! ERROR: Clause GANG is not allowed if clause GANG appears on the ROUTINE directive
19
29
! $acc routine gang gang
You can’t perform that action at this time.
0 commit comments