[flang-commits] [flang] [flang] Allow acc cache directive inside acc routine (PR #184213)

Valentin Clement バレンタイン クレメン via flang-commits flang-commits at lists.llvm.org
Mon Mar 2 11:54:20 PST 2026


================
@@ -668,7 +669,7 @@ void AccStructureChecker::Enter(const parser::OpenACCCacheConstruct &x) {
   const auto &verbatim = std::get<parser::Verbatim>(x.t);
   PushContextAndClauseSets(verbatim.source, llvm::acc::Directive::ACCD_cache);
   SetContextDirectiveSource(verbatim.source);
-  if (loopNestLevel == 0) {
+  if (loopNestLevel == 0 && !hasAccRoutineDirective) {
     context_.Say(
         verbatim.source, "The CACHE directive must be inside a loop"_err_en_US);
----------------
clementval wrote:

Should we update the error message to include routine? 

https://github.com/llvm/llvm-project/pull/184213


More information about the flang-commits mailing list