aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/riscv/riscv-avlprop.cc
diff options
context:
space:
mode:
authorPan Li <pan2.li@intel.com>2023-10-28 22:48:58 +0800
committerPan Li <pan2.li@intel.com>2023-10-29 08:40:11 +0800
commitb8b63e87669ef835e367f7b8ad437c6d1a6791f1 (patch)
tree5628f6f2756feb34acd6d2f79469eb82b889b734 /gcc/config/riscv/riscv-avlprop.cc
parentb0f702922ab9be2ad449d5ed172e369a9f63c49c (diff)
downloadgcc-b8b63e87669ef835e367f7b8ad437c6d1a6791f1.zip
gcc-b8b63e87669ef835e367f7b8ad437c6d1a6791f1.tar.gz
gcc-b8b63e87669ef835e367f7b8ad437c6d1a6791f1.tar.bz2
RISC-V: Fix one range-loop-construct warning of avlprop
This patch would like to fix one warning of avlprop as below. ../../gcc/config/riscv/riscv-avlprop.cc: In member function 'virtual unsigned int pass_avlprop::execute(function*)': ../../gcc/config/riscv/riscv-avlprop.cc:346:23: error: loop variable 'candidate' creates a copy from type 'const std::pair<avlprop_type, rtl_ssa::insn_info*>' [-Werror=range-loop-construct] 346 | for (const auto candidate : m_candidates) | ^~~~~~~~~ ../../gcc/config/riscv/riscv-avlprop.cc:346:23: note: use reference type to prevent copying 346 | for (const auto candidate : m_candidates) | ^~~~~~~~~ | & gcc/ChangeLog: * config/riscv/riscv-avlprop.cc (pass_avlprop::execute): Use reference type to prevent copying. Signed-off-by: Pan Li <pan2.li@intel.com>
Diffstat (limited to 'gcc/config/riscv/riscv-avlprop.cc')
-rw-r--r--gcc/config/riscv/riscv-avlprop.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/config/riscv/riscv-avlprop.cc b/gcc/config/riscv/riscv-avlprop.cc
index 2c79ec8..c59eb7f 100644
--- a/gcc/config/riscv/riscv-avlprop.cc
+++ b/gcc/config/riscv/riscv-avlprop.cc
@@ -343,7 +343,7 @@ pass_avlprop::execute (function *fn)
{
fprintf (dump_file, "\nNumber of potential AVL propagations: %d\n",
m_candidates.length ());
- for (const auto candidate : m_candidates)
+ for (const auto &candidate : m_candidates)
{
fprintf (dump_file, "\nAVL propagation type: %s\n",
avlprop_type_to_str (candidate.first));