bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Pacify gcc -Wpointer-to-int-cast


From: Paul Eggert
Subject: [PATCH] Pacify gcc -Wpointer-to-int-cast
Date: Sun, 26 Mar 2023 16:41:57 -0700

* lib/sh/random.c (genseed): Use a different type, to pacify GCC
"warning: cast from pointer to integer of different size
[-Wpointer-to-int-cast]" on platforms with 64-bit pointers
and 32-bit int.
---
 lib/sh/random.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/sh/random.c b/lib/sh/random.c
index 1faeacae..16877430 100644
--- a/lib/sh/random.c
+++ b/lib/sh/random.c
@@ -91,7 +91,7 @@ genseed (void)
   u_bits32_t iv;
 
   gettimeofday (&tv, NULL);
-  iv = (u_bits32_t)seedrand;           /* let the compiler truncate */
+  iv = (uintptr_t)seedrand;            /* let the compiler truncate */
   iv = tv.tv_sec ^ tv.tv_usec ^ getpid () ^ getppid () ^ current_user.uid ^ iv;
   return (iv);
 }
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]