Skip to content

Commit 8a0f694

Browse files
authored
[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`.
1 parent c51b24c commit 8a0f694

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

flang/lib/Lower/PFTBuilder.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,8 +878,18 @@ class PFTBuilder {
878878
lower::pft::Evaluation *target{
879879
labelEvaluationMap->find(label)->second};
880880
assert(target && "missing branch target evaluation");
881-
if (!target->isA<parser::FormatStmt>())
881+
if (!target->isA<parser::FormatStmt>()) {
882882
target->isNewBlock = true;
883+
for (lower::pft::Evaluation *parent = target->parentConstruct;
884+
parent; parent = parent->parentConstruct) {
885+
parent->isUnstructured = true;
886+
// The exit of an enclosing DO or IF construct is a new block.
887+
if (parent->constructExit &&
888+
(parent->isA<parser::DoConstruct>() ||
889+
parent->isA<parser::IfConstruct>()))
890+
parent->constructExit->isNewBlock = true;
891+
}
892+
}
883893
auto iter = assignSymbolLabelMap->find(*sym);
884894
if (iter == assignSymbolLabelMap->end()) {
885895
lower::pft::LabelSet labelSet{};

0 commit comments

Comments
 (0)