bash-3.00$ cat z1.c 
int foo(void);
void bar(void) { (unsigned int)foo(); }
bash-3.00$ vi z1.c 
bash-3.00$ /usr/local/gcc-4.1-branch/bin/gcc -c z1.c -Wall -O2
z1.c: In function ‘bar’:
z1.c:1: warning: value computed is not used

bash-3.00$ /usr/local/gcc-4.1-branch/bin/gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/usr/local/gcc-4.1-branch
--with-gnu-ld=/usr/local/binutils-2.16.1/bin/ld
--with-gnu-as=/usr/local/binutils-2.16.1/bin/as
Thread model: posix
gcc version 4.1.0 20060118 (prerelease)

Background:

Wine's windowsx.h defines:

#define ListBox_SetCurSel(hwndCtl, index) \
        ((int)SendMessage((hwndCtl), LB_SETCURSEL, (WPARAM)(int)(index), 0L))

Using this macro will give a warning in the gcc 4.1 branch, but not with gcc
4.0.2.  Though the warning is technically correct, it doesn't really make much
sense, and I can't think of a real problem it's going to catch.


-- 
           Summary: regression: value computed not used warning with cast
                    return value
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mike at codeweavers dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i486-slackware-linux
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to