[flang-commits] [flang] 8a0f694 - [flang] Legacy ASSIGN statement target processing (#133737)
via flang-commits
flang-commits at lists.llvm.org
Wed Apr 2 06:52:16 PDT 2025
Author: vdonaldson
Date: 2025-04-02T09:52:13-04:00
New Revision: 8a0f694381cece71f1b974f65f3121020522d6f1
URL: https://github.com/llvm/llvm-project/commit/8a0f694381cece71f1b974f65f3121020522d6f1
DIFF: https://github.com/llvm/llvm-project/commit/8a0f694381cece71f1b974f65f3121020522d6f1.diff
LOG: [flang] Legacy ASSIGN statement target processing (#133737)
Like other target statements, the statement associated with the label in
a legacy ASSIGN statement could be inside a construct. Constructs
containing such a target must therefore be marked as unstructured,
fairly similar to how targets are processed in `markBranchTarget`.
Added:
Modified:
flang/lib/Lower/PFTBuilder.cpp
Removed:
################################################################################
diff --git a/flang/lib/Lower/PFTBuilder.cpp b/flang/lib/Lower/PFTBuilder.cpp
index 41bdff4dca471..2cc458cb6130d 100644
--- a/flang/lib/Lower/PFTBuilder.cpp
+++ b/flang/lib/Lower/PFTBuilder.cpp
@@ -878,8 +878,18 @@ class PFTBuilder {
lower::pft::Evaluation *target{
labelEvaluationMap->find(label)->second};
assert(target && "missing branch target evaluation");
- if (!target->isA<parser::FormatStmt>())
+ if (!target->isA<parser::FormatStmt>()) {
target->isNewBlock = true;
+ for (lower::pft::Evaluation *parent = target->parentConstruct;
+ parent; parent = parent->parentConstruct) {
+ parent->isUnstructured = true;
+ // The exit of an enclosing DO or IF construct is a new block.
+ if (parent->constructExit &&
+ (parent->isA<parser::DoConstruct>() ||
+ parent->isA<parser::IfConstruct>()))
+ parent->constructExit->isNewBlock = true;
+ }
+ }
auto iter = assignSymbolLabelMap->find(*sym);
if (iter == assignSymbolLabelMap->end()) {
lower::pft::LabelSet labelSet{};
More information about the flang-commits
mailing list