[flang-commits] [flang] 0dd2ed4 - [flang][OpenACC] Fix crash due to truncated scope source range (#136206)

via flang-commits flang-commits at lists.llvm.org
Fri Apr 18 12:52:24 PDT 2025


Author: Peter Klausler
Date: 2025-04-18T12:52:21-07:00
New Revision: 0dd2ed4ea3b16ee0cd88becf4dc9eb5bacd08ca9

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

LOG: [flang][OpenACC] Fix crash due to truncated scope source range (#136206)

A combined construct needs to ensure that the source range of their
initial statement is part of the source range of their scope.

Fixes https://github.com/llvm/llvm-project/issues/136076.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 7ec6252530d55..f1d2ba4078236 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -1384,6 +1384,20 @@ class AccVisitor : public virtual DeclarationVisitor {
   void Post(const parser::AccEndBlockDirective &) {
     messageHandler().set_currStmtSource(std::nullopt);
   }
+  bool Pre(const parser::AccBeginCombinedDirective &x) {
+    AddAccSourceRange(x.source);
+    return true;
+  }
+  void Post(const parser::AccBeginCombinedDirective &) {
+    messageHandler().set_currStmtSource(std::nullopt);
+  }
+  bool Pre(const parser::AccEndCombinedDirective &x) {
+    AddAccSourceRange(x.source);
+    return true;
+  }
+  void Post(const parser::AccEndCombinedDirective &) {
+    messageHandler().set_currStmtSource(std::nullopt);
+  }
   bool Pre(const parser::AccBeginLoopDirective &x) {
     AddAccSourceRange(x.source);
     return true;


        


More information about the flang-commits mailing list