public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Silence ubsan warning about 1<<31
@ 2023-01-31  4:52 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-01-31  4:52 UTC (permalink / raw)
  To: binutils

	* merge.c (hash_blob): Write 1u << 31.

diff --git a/bfd/merge.c b/bfd/merge.c
index f21154dcd45..327bd66b341 100644
--- a/bfd/merge.c
+++ b/bfd/merge.c
@@ -279,7 +279,7 @@ hash_blob (const char *str, unsigned int len)
   uint32_t ret = 0;
   uint32_t mul = (1 << 0) +  (1 << 2) + (1 << 3) + (1 << 5) + (1 << 7);
   mul += (1 << 11) + (1 << 13) + (1 << 17) + (0 << 19) + (1 << 23) + (1 << 29);
-  mul += (1 << 31);
+  mul += (1u << 31);
   if (len >= 8)
     {
       uint32_t acc = len * 0x9e3779b1;

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-31  4:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-31  4:52 Silence ubsan warning about 1<<31 Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).