[flang-commits] [flang] b1f3667 - [flang][openacc] Disallow the zero modifier on the copyout clause with the declare directive

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Wed Aug 2 15:52:20 PDT 2023


Author: Valentin Clement
Date: 2023-08-02T15:52:14-07:00
New Revision: b1f3667a60bcca2c4a3c294e89fa1554fa9330f7

URL: https://github.com/llvm/llvm-project/commit/b1f3667a60bcca2c4a3c294e89fa1554fa9330f7
DIFF: https://github.com/llvm/llvm-project/commit/b1f3667a60bcca2c4a3c294e89fa1554fa9330f7.diff

LOG: [flang][openacc] Disallow the zero modifier on the copyout clause with the declare directive

The OpenACC 3.3 specification does not allow the `zero` modifier
on the `copyout` clause used with the declare directive.

This is similar to D156703 for the create clause.

This might be missing piece in the spec but we disallow it until proven otherwise.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D156825

Added: 
    

Modified: 
    flang/lib/Semantics/check-acc-structure.cpp
    flang/test/Semantics/OpenACC/acc-declare-validity.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/check-acc-structure.cpp b/flang/lib/Semantics/check-acc-structure.cpp
index 4ed3b32eec5c3a..ff2fce261cd460 100644
--- a/flang/lib/Semantics/check-acc-structure.cpp
+++ b/flang/lib/Semantics/check-acc-structure.cpp
@@ -438,6 +438,15 @@ void AccStructureChecker::Enter(const parser::AccClause::Copyout &c) {
                   .str()),
           ContextDirectiveAsFortran());
     }
+    if (GetContext().directive == llvm::acc::Directive::ACCD_declare) {
+      context_.Say(GetContext().clauseSource,
+          "The ZERO modifier is not allowed for the %s clause "
+          "on the %s directive"_err_en_US,
+          parser::ToUpperCaseLetters(
+              llvm::acc::getOpenACCClauseName(llvm::acc::Clause::ACCC_copyout)
+                  .str()),
+          ContextDirectiveAsFortran());
+    }
   }
 }
 

diff  --git a/flang/test/Semantics/OpenACC/acc-declare-validity.f90 b/flang/test/Semantics/OpenACC/acc-declare-validity.f90
index 5a5a5407f77aa8..6fa3b33bb2ccde 100644
--- a/flang/test/Semantics/OpenACC/acc-declare-validity.f90
+++ b/flang/test/Semantics/OpenACC/acc-declare-validity.f90
@@ -57,4 +57,10 @@ subroutine sub2(cc)
     !$acc declare present(cc)
   end subroutine sub2
 
+  subroutine sub3()
+    real :: aa(100)
+    !ERROR: The ZERO modifier is not allowed for the COPYOUT clause on the DECLARE directive
+    !$acc declare copyout(zero: aa)
+  end subroutine
+
 end module openacc_declare_validity


        


More information about the flang-commits mailing list