From: David Truby Date: Thu, 19 Mar 2020 11:04:28 +0000 (+0000) Subject: [flang] Add explicit nullptr check in initialisation of inDoConstruct. X-Git-Tag: llvmorg-12-init~9537^2~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cc77f818f21371287bf692ca2a3968b81c5dc9f1;p=platform%2Fupstream%2Fllvm.git [flang] Add explicit nullptr check in initialisation of inDoConstruct. This explicit check is needed as we are using braced initialisation here so implicit narrowing conversions (such as pointer to bool) are not allowed. Original-commit: flang-compiler/f18@ff8dad10bffb70666ba3b4ff229dc4b608f9e116 Reviewed-on: https://github.com/flang-compiler/f18/pull/1083 --- diff --git a/flang/lib/Semantics/check-do-forall.cpp b/flang/lib/Semantics/check-do-forall.cpp index 6dfd51c..58b434b 100644 --- a/flang/lib/Semantics/check-do-forall.cpp +++ b/flang/lib/Semantics/check-do-forall.cpp @@ -912,7 +912,7 @@ void DoForallChecker::CheckForBadLeave( static bool StmtMatchesConstruct(const parser::Name *stmtName, StmtType stmtType, const parser::Name *constructName, const ConstructNode &construct) { - bool inDoConstruct{MaybeGetDoConstruct(construct)}; + bool inDoConstruct{MaybeGetDoConstruct(construct) != nullptr}; if (!stmtName) { return inDoConstruct; // Unlabeled statements match all DO constructs } else if (constructName && constructName->source == stmtName->source) {