Skip to content

Conversation

@klausler
Copy link
Contributor

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

Fixes #136076.

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

Fixes llvm#136076.
@klausler klausler requested a review from clementval April 17, 2025 21:37
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:semantics labels Apr 17, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 17, 2025

@llvm/pr-subscribers-flang-semantics

Author: Peter Klausler (klausler)

Changes

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

Fixes #136076.


Full diff: https://github.com/llvm/llvm-project/pull/136206.diff

1 Files Affected:

  • (modified) flang/lib/Semantics/resolve-names.cpp (+14)
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 74367b5229548..a04d976c69f05 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;

Copy link
Contributor

@clementval clementval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@klausler klausler merged commit 0dd2ed4 into llvm:main Apr 18, 2025
14 checks passed
@klausler klausler deleted the bug136076 branch April 18, 2025 19:52
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…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 llvm#136076.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flang:semantics flang Flang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Flang][OpenACC] fatal internal error: SemanticsContext::FindScope(): invalid source location for 'kernels loop'

3 participants