While reading the hash_map code I noticed this inconsistency. Bootstrapped and 
regtested on x86_64. OK for trunk?


The hash_map::traverse overload taking a non-const Value pointer breaks
if the callback returns false. The other overload should behave the
same.

Signed-off-by: Matthias Kretz <m.kr...@gsi.de>

gcc/ChangeLog:

        * hash-map.h (hash_map::traverse): Let both overloads behave the
        same.
---
 gcc/hash-map.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


--
──────────────────────────────────────────────────────────────────────────
 Dr. Matthias Kretz                           https://mattkretz.github.io
 GSI Helmholtz Centre for Heavy Ion Research               https://gsi.de
 stdₓ::simd
──────────────────────────────────────────────────────────────────────────
diff --git a/gcc/hash-map.h b/gcc/hash-map.h
index dd039f10343..6e1c7b6e071 100644
--- a/gcc/hash-map.h
+++ b/gcc/hash-map.h
@@ -225,7 +225,8 @@ public:
     {
       for (typename hash_table<hash_entry>::iterator iter = m_table.begin ();
 	   iter != m_table.end (); ++iter)
-	f ((*iter).m_key, (*iter).m_value, a);
+	if (!f ((*iter).m_key, (*iter).m_value, a))
+	  break;
     }
 
   template<typename Arg, bool (*f)(const typename Traits::key_type &,

Reply via email to