diff --git a/flang/lib/Lower/ConvertCall.cpp b/flang/lib/Lower/ConvertCall.cpp --- a/flang/lib/Lower/ConvertCall.cpp +++ b/flang/lib/Lower/ConvertCall.cpp @@ -1693,11 +1693,12 @@ bool canLoadActualArgumentBeforeLoop(unsigned argIdx) const { using PassBy = Fortran::lower::CallerInterface::PassEntityBy; - assert(argIdx < caller.getPassedArguments().size() && "bad argument index"); + const auto &passedArgs{caller.getPassedArguments()}; + assert(argIdx < passedArgs.size() && "bad argument index"); // If the actual argument does not need to be passed via an address, // or will be passed in the address of a temporary copy, it can be loaded // before the elemental loop nest. - const auto &arg = caller.getPassedArguments()[argIdx]; + const auto &arg{passedArgs[argIdx]}; return arg.passBy == PassBy::Value || arg.passBy == PassBy::BaseAddressValueAttribute; } diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp --- a/flang/lib/Lower/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP.cpp @@ -2662,8 +2662,8 @@ const auto &expr{std::get(assignmentStmt.t)}; const auto *e{Fortran::semantics::GetExpr(expr)}; const auto *v{Fortran::semantics::GetExpr(var)}; - const Fortran::semantics::Symbol &varSymbol = - Fortran::evaluate::GetSymbolVector(*v).front(); + auto varSyms{Fortran::evaluate::GetSymbolVector(*v)}; + const Fortran::semantics::Symbol &varSymbol{*varSyms.front()}; for (const Fortran::semantics::Symbol &symbol : Fortran::evaluate::GetSymbolVector(*e)) if (varSymbol == symbol) diff --git a/flang/lib/Semantics/runtime-type-info.cpp b/flang/lib/Semantics/runtime-type-info.cpp --- a/flang/lib/Semantics/runtime-type-info.cpp +++ b/flang/lib/Semantics/runtime-type-info.cpp @@ -202,7 +202,8 @@ if (x.empty()) { return SomeExpr{evaluate::NullPointer{}}; } else { - const auto &derivedType{x.front().GetType().GetDerivedTypeSpec()}; + auto dyType{x.front().GetType()}; + const auto &derivedType{dyType.GetDerivedTypeSpec()}; ObjectEntityDetails object; DeclTypeSpec typeSpec{DeclTypeSpec::TypeDerived, derivedType}; if (const DeclTypeSpec * spec{scope.FindType(typeSpec)}) {