[flang-commits] [flang] [flang][OpenACC] Fix crash due to truncated scope source range (PR #136206)
via flang-commits
flang-commits at lists.llvm.org
Thu Apr 17 14:38:05 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-semantics
Author: Peter Klausler (klausler)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/136206.diff
1 Files Affected:
- (modified) flang/lib/Semantics/resolve-names.cpp (+14)
``````````diff
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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/136206
More information about the flang-commits
mailing list