[flang] Fix controlSuccessor chain for select type construct
authorValentin Clement <clementval@gmail.com>
Sat, 5 Nov 2022 14:10:40 +0000 (15:10 +0100)
committerValentin Clement <clementval@gmail.com>
Sat, 5 Nov 2022 14:11:30 +0000 (15:11 +0100)
Represent the select type statement + type guard statement
the same way the select case statement and case statement are represented.
controlSuccessor was not correctly attributed to the next type guard stmt.

Reviewed By: PeteSteinfeld, vdonaldson

Differential Revision: https://reviews.llvm.org/D137460

flang/lib/Lower/PFTBuilder.cpp

index 62ec5ad..8f87e96 100644 (file)
@@ -904,8 +904,13 @@ private:
           [&](const parser::SelectRankCaseStmt &) { eval.isNewBlock = true; },
           [&](const parser::SelectTypeStmt &s) {
             insertConstructName(s, parentConstruct);
+            lastConstructStmtEvaluation = &eval;
+          },
+          [&](const parser::TypeGuardStmt &) {
+            eval.isNewBlock = true;
+            lastConstructStmtEvaluation->controlSuccessor = &eval;
+            lastConstructStmtEvaluation = &eval;
           },
-          [&](const parser::TypeGuardStmt &) { eval.isNewBlock = true; },
 
           // Constructs - set (unstructured) construct exit targets
           [&](const parser::AssociateConstruct &) { setConstructExit(eval); },