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 @@ -900,8 +900,13 @@ }, [&](const parser::SelectRankStmt &s) { insertConstructName(s, parentConstruct); + lastConstructStmtEvaluation = &eval; + }, + [&](const parser::SelectRankCaseStmt &) { + eval.isNewBlock = true; + lastConstructStmtEvaluation->controlSuccessor = &eval; + lastConstructStmtEvaluation = &eval; }, - [&](const parser::SelectRankCaseStmt &) { eval.isNewBlock = true; }, [&](const parser::SelectTypeStmt &s) { insertConstructName(s, parentConstruct); lastConstructStmtEvaluation = &eval;