[Bug preprocessor/27509] New: wrong warning about an unused variable

toralf dot foerster at gmx dot de gcc-bugzilla@gcc.gnu.org
Mon May 8 20:09:00 GMT 2006


gcc complains about an unused variable while ompiling the kernel tree
2.6.17-rc3-git14 :

...
  CC      mm/vmscan.o
mm/vmscan.c: In function `remove_mapping':
mm/vmscan.c:382: warning: unused variable `swap'
  CC      mm/prio_tree.o
  CC      mm/util.o

...


But the variable seems to be used :
...
        if (PageSwapCache(page)) {
                swp_entry_t swap = { .val = page_private(page) };
                __delete_from_swap_cache(page);
                write_unlock_irq(&mapping->tree_lock);
                swap_free(swap); <-----------------------------------
...

The compiler version is:

$> gcc -v
Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.5/specs
Configured with: /var/tmp/portage/gcc-3.4.5-r1/work/gcc-3.4.5/configure
--prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.4.5
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.5/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.5
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.5/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.5/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.5/include/g++-v3
--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec
--enable-nls --without-included-gettext --with-system-zlib --disable-checking
--disable-werror --disable-libunwind-exceptions --disable-multilib
--disable-libgcj --enable-languages=c,c++,f77 --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 3.4.5 (Gentoo 3.4.5-r1, ssp-3.4.5-1.0, pie-8.7.9)


And this the host system: 

$> uname -a
Linux n22 2.6.16-gentoo-r6 #3 Fri May 5 11:59:58 CEST 2006 i686 Intel(R)
Pentium(R) M processor 1700MHz GNU/Linux

The kernel config can be found here
http://bugzilla.kernel.org/attachment.cgi?id=8037&action=view


-- 
           Summary: wrong warning about an unused variable
           Product: gcc
           Version: 3.4.5
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: toralf dot foerster at gmx dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27509



More information about the Gcc-bugs mailing list