diff --git a/flang/lib/Lower/PFTBuilder.cpp b/flang/lib/Lower/PFTBuilder.cpp --- a/flang/lib/Lower/PFTBuilder.cpp +++ b/flang/lib/Lower/PFTBuilder.cpp @@ -904,8 +904,13 @@ [&](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); },