[flang-commits] [PATCH] D156750: [flang] Attempt to silence new GCC warnings

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Aug 1 16:48:08 PDT 2023


klausler updated this revision to Diff 546266.
klausler added a comment.

Address warnings without breaking tests.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156750/new/

https://reviews.llvm.org/D156750

Files:
  flang/lib/Lower/ConvertCall.cpp
  flang/lib/Lower/OpenMP.cpp
  flang/lib/Semantics/runtime-type-info.cpp


Index: flang/lib/Semantics/runtime-type-info.cpp
===================================================================
--- flang/lib/Semantics/runtime-type-info.cpp
+++ 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)}) {
Index: flang/lib/Lower/OpenMP.cpp
===================================================================
--- flang/lib/Lower/OpenMP.cpp
+++ flang/lib/Lower/OpenMP.cpp
@@ -2662,8 +2662,8 @@
   const auto &expr{std::get<Fortran::parser::Expr>(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)
Index: flang/lib/Lower/ConvertCall.cpp
===================================================================
--- flang/lib/Lower/ConvertCall.cpp
+++ 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;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156750.546266.patch
Type: text/x-patch
Size: 2308 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230801/2d7abfd9/attachment.bin>


More information about the flang-commits mailing list