]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
du: avoid spurious warnings with 64-bit gcc -W
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 6 Jul 2010 23:16:20 +0000 (16:16 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 6 Jul 2010 23:16:50 +0000 (16:16 -0700)
Problem reported by Jim Meyering in:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6524#74
* gl/lib/di-set.c (di_ent_hash): Rework so that the compiler does
not incorrectly warn about shifting by 64-bits in unreachable code.
* gl/lib/ino-map.c (ino_hash): Likewise.

gl/lib/di-set.c
gl/lib/ino-map.c

index e0e2b24dd4e679b27ffd401eff801122a26aef0f..ba44bcfff3d148cbf6aa33b349f70e746abc31a4 100644 (file)
@@ -83,7 +83,7 @@ di_ent_hash (void const *x, size_t table_size)
   size_t h = dev;
   int i;
   for (i = 1; i < sizeof dev / sizeof h + (sizeof dev % sizeof h != 0); i++)
-    h ^= dev >>= CHAR_BIT * sizeof h;
+    h ^= dev >> CHAR_BIT * sizeof h * i;
 
   return h % table_size;
 }
index c86898365c27dc4a911c0938e9c75f8aed5d6940..cc9a131c98a29d1e05157b3a3796a1c91f829119 100644 (file)
@@ -61,7 +61,7 @@ ino_hash (void const *x, size_t table_size)
   size_t h = ino;
   int i;
   for (i = 1; i < sizeof ino / sizeof h + (sizeof ino % sizeof h != 0); i++)
-    h ^= ino >>= CHAR_BIT * sizeof h;
+    h ^= ino >> CHAR_BIT * sizeof h * i;
 
   return h % table_size;
 }