[flang-commits] [PATCH] D156750: [flang] Attempt to silence new GCC warnings
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Mon Jul 31 15:10:26 PDT 2023
klausler created this revision.
klausler added a reviewer: clementval.
klausler added a project: Flang.
Herald added subscribers: sunshaoce, mehdi_amini, jdoerfert.
Herald added a reviewer: sscalpone.
Herald added a reviewer: kiranchandramohan.
Herald added a project: All.
klausler requested review of this revision.
Restructure three code sites that are now eliciting new warnings
from the latest GCC compiler. One of these looks like a
legitimate problem with a reference to an expression temporary.
Fixes https://github.com/llvm/llvm-project/issues/64200.
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
@@ -2645,8 +2645,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
@@ -1697,7 +1697,8 @@
// 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];
+ auto passedArgs{caller.getPassedArguments()};
+ const auto &arg{passedArgsflang[argIdx]};
return arg.passBy == PassBy::Value ||
arg.passBy == PassBy::BaseAddressValueAttribute;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156750.545827.patch
Type: text/x-patch
Size: 2022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230731/f16fa092/attachment-0001.bin>
More information about the flang-commits
mailing list