From 72b6b1d3138646ba38b60fac9039e8daf90514be Mon Sep 17 00:00:00 2001 From: V Donaldson Date: Tue, 19 May 2020 15:58:15 -0700 Subject: [PATCH] Review update --- flang/lib/Lower/Bridge.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp index ca66ed43d3278c..710f55702bf5e9 100644 --- a/flang/lib/Lower/Bridge.cpp +++ b/flang/lib/Lower/Bridge.cpp @@ -1666,21 +1666,25 @@ class FirConverter : public Fortran::lower::AbstractConverter { setCurrentPosition(eval.position); if (unstructuredContext) { // When transitioning from unstructured to structured code, - // the structured code might be a target that starts a new block. + // the structured code could be a target that starts a new block. maybeStartBlock(eval.isConstruct() && eval.lowerAsStructured() ? eval.evaluationList->front().block : eval.block); } + eval.visit([&](const auto &stmt) { genFIR(eval, stmt); }); + if (unstructuredContext && blockIsUnterminated()) { // Exit from an unstructured IF or SELECT construct block. Fortran::lower::pft::Evaluation *successor{}; - if (eval.isActionStmt()) + if (eval.isActionStmt()) { successor = eval.controlSuccessor; - else if (eval.isConstruct() && - eval.evaluationList->back() + } else if (eval.isConstruct()) { + assert(!eval.evaluationList->empty() && "empty construct eval list"); + if (eval.evaluationList->back() .lexicalSuccessor->isIntermediateConstructStmt()) - successor = eval.constructExit; + successor = eval.constructExit; + } if (successor && successor->block) genBranch(successor->block); }