[flang-commits] [flang] 558c1f1 - [Flang][OpenMP] skip CompilerDirective on ResolveOmpTopLevelParts. (#69580)

via flang-commits flang-commits at lists.llvm.org
Fri Oct 27 17:28:59 PDT 2023


Author: Z572
Date: 2023-10-28T08:28:55+08:00
New Revision: 558c1f123ea7f3134c1f34124df6921376465494

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

LOG: [Flang][OpenMP] skip CompilerDirective on ResolveOmpTopLevelParts. (#69580)

Fixes #68966

Added: 
    flang/test/Semantics/OpenMP/compiler-directive.f90

Modified: 
    flang/lib/Semantics/resolve-directives.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index 2a6523f579f2773..66d3a9da3650579 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -2241,7 +2241,9 @@ void ResolveOmpTopLevelParts(
       if (!std::holds_alternative<common::Indirection<parser::Module>>(
               unit.u) &&
           !std::holds_alternative<common::Indirection<parser::Submodule>>(
-              unit.u)) {
+              unit.u) &&
+          !std::holds_alternative<
+              common::Indirection<parser::CompilerDirective>>(unit.u)) {
         Symbol *symbol{common::visit(
             [&context](auto &x) {
               Scope *scope = GetScope(context, x.value());

diff  --git a/flang/test/Semantics/OpenMP/compiler-directive.f90 b/flang/test/Semantics/OpenMP/compiler-directive.f90
new file mode 100644
index 000000000000000..5d3e9bae27fd8fa
--- /dev/null
+++ b/flang/test/Semantics/OpenMP/compiler-directive.f90
@@ -0,0 +1,8 @@
+! RUN: %python %S/../test_errors.py %s %flang -fopenmp
+! CompilerDirective with openmp tests
+
+!ERROR: !DIR$ IGNORE_TKR directive must appear in a subroutine or function
+!dir$ ignore_tkr
+
+program main
+end program main


        


More information about the flang-commits mailing list