Casting to intptr_t states the intent of an integer to pointer cast
more clearly and ensures that the cast causes no loss of precision on
any platforms. LLP64 platforms eg. have a long value of 4 bytes and
pointer values of 8 bytes which may even cause compiler errors.

Fixes PR 96608

Would need this to be committed for me if accepted. (username
zero9178, email markus.boec...@gmail.com)

Markus

gcc/analyzer/ChangeLog:
PR analyzer/96608

* store.h (hash): Cast to intptr_t instead of long

---
 gcc/analyzer/store.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/analyzer/store.h b/gcc/analyzer/store.h
index 0f4e7ab2a56..9589c566e1b 100644
--- a/gcc/analyzer/store.h
+++ b/gcc/analyzer/store.h
@@ -269,7 +269,7 @@ public:

   hashval_t hash () const
   {
-    return (binding_key::impl_hash () ^ (long)m_region);
+    return (binding_key::impl_hash () ^ (intptr_t)m_region);
   }
   bool operator== (const symbolic_binding &other) const
   {
-- 
2.17.1

Reply via email to