On systems where sizeof(void*) != sizeof(unsigned int) (e.g. on most 64-bit platforms), we get a warning like so: tmpfile.c: In function 'sh_seedrand': tmpfile.c:128:61: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] srandom (tv.tv_sec ^ tv.tv_usec ^ (getpid () << 16) ^ (unsigned int)&d);
Use the standard uintptr_t to turn the pointer into an integer. --- lib/sh/tmpfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sh/tmpfile.c b/lib/sh/tmpfile.c index 7c2fbf22fbe6..e41e45bd7cac 100644 --- a/lib/sh/tmpfile.c +++ b/lib/sh/tmpfile.c @@ -125,7 +125,7 @@ sh_seedrand () struct timeval tv; gettimeofday (&tv, NULL); - srandom (tv.tv_sec ^ tv.tv_usec ^ (getpid () << 16) ^ (unsigned int)&d); + srandom (tv.tv_sec ^ tv.tv_usec ^ (getpid () << 16) ^ (uintptr_t)&d); seeded = 1; } #endif -- 2.9.0