about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-11-12 01:31:29 -0500
committerUlrich Drepper <drepper@gmail.com>2011-11-12 01:31:29 -0500
commit294ce12680bfa52aa7f9f1cb93b2bb5b2d22eaae (patch)
treeca78fbdef3367395809838ef363e85f40922b77e
parent5e2b63c65892e054980570957f533312cfd223c2 (diff)
downloadglibc-294ce12680bfa52aa7f9f1cb93b2bb5b2d22eaae.tar.gz
glibc-294ce12680bfa52aa7f9f1cb93b2bb5b2d22eaae.tar.xz
glibc-294ce12680bfa52aa7f9f1cb93b2bb5b2d22eaae.zip
Avoid warning from shifting
-rw-r--r--ChangeLog3
-rw-r--r--sysdeps/unix/sysv/linux/internal_statvfs.c8
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 897174e887..aa29e14e13 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2011-11-12  Ulrich Drepper  <drepper@gmail.com>
 
+	* sysdeps/unix/sysv/linux/internal_statvfs.c (INTERNAL_STATVFS): Use
+	unsigned long long int to avoid warnings in shift.
+
 	* posix/regex_internal.c (re_string_reconstruct): Actually use result
 	of use of trans.
 	* posix/regex_internal.h (re_string_wchar_at): Remove temporary
diff --git a/sysdeps/unix/sysv/linux/internal_statvfs.c b/sysdeps/unix/sysv/linux/internal_statvfs.c
index 2ddec1edba..a0bad02d79 100644
--- a/sysdeps/unix/sysv/linux/internal_statvfs.c
+++ b/sysdeps/unix/sysv/linux/internal_statvfs.c
@@ -237,9 +237,13 @@ INTERNAL_STATVFS (const char *name, struct STATVFS *buf,
   buf->f_files = fsbuf->f_files;
   buf->f_ffree = fsbuf->f_ffree;
   if (sizeof (buf->f_fsid) == sizeof (fsbuf->f_fsid))
+    /* The shifting uses 'unsigned long long int' even though the target
+       field might only have 32 bits.  This is OK since the 'if' branch
+       is not used in this case but the compiler would still generate
+       warnings.  */
     buf->f_fsid = ((fsbuf->f_fsid.__val[0]
-		    & ((1UL << (8 * sizeof (fsbuf->f_fsid.__val[0]))) - 1))
-		   | ((unsigned long int) fsbuf->f_fsid.__val[1]
+		    & ((1ULL << (8 * sizeof (fsbuf->f_fsid.__val[0]))) - 1))
+		   | ((unsigned long long int) fsbuf->f_fsid.__val[1]
 		      << (8 * (sizeof (buf->f_fsid)
 			       - sizeof (fsbuf->f_fsid.__val[0])))));
   else