diff mbox

PR28901 -Wunused-variable ignores unused const initialised variables

Message ID 1442343363.8165.358.camel@bordewijk.wildebeest.org
State New
Headers show

Commit Message

Mark Wielaard Sept. 15, 2015, 6:56 p.m. UTC
On Tue, 2015-09-15 at 20:33 +0200, Mark Wielaard wrote:
> I build glibc and found 9 unused variables. They all look like they are
> really not used in the code, so they can all just be removed. Someone of
> course should double check they aren't unused by accident before
> committing upstream.

For the record there was one other issue with building glibc with
current GCC6 was:

 tst-endian.c: In function ‘do_test’:
 tst-endian.c:22:30: error: self-comparison always evaluates to false [-Werror=tautological-compare]
     if (htole16 (le16toh (i)) != i)
                               ^
which is fixed by:
diff mbox

Patch

diff --git a/string/tst-endian.c b/string/tst-endian.c
index 8684bb2..9d64a87 100644
--- a/string/tst-endian.c
+++ b/string/tst-endian.c
@@ -9,7 +9,7 @@  do_test (void)
 {
   int result = 0;
 
-  for (uint64_t i = 0; i < (~UINT64_C (0)) >> 2; i = (i << 1) + 3)
+  for (volatile uint64_t i = 0; i < (~UINT64_C (0)) >> 2; i = (i << 1) + 3)
     {
       if (i < UINT64_C (65536))
        {