This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -Wconversion bug in g++-4.3?
- From: "Manuel López-Ibáñez" <lopezibanez at gmail dot com>
- To: "Tom Browder" <tom dot browder at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 22 Nov 2007 17:46:34 +0100
- Subject: Re: -Wconversion bug in g++-4.3?
- References: <8bc817ee0711220633t68c7f078udc507d902830860@mail.gmail.com>
On 22/11/2007, Tom Browder <tom.browder@gmail.com> wrote:
> Compile with g++ 4.3-20071109:
>
> $ g++-4.3-20071109 -c f.cc -Wconversion
> f.cc: In function 'void f(unsigned char)':
> f.cc:3: warning: conversion to 'unsigned char' from 'int' may alter its value
>
> Is this a legitimate warning or a bug? If so, is there anything to be
> done to eliminate the warning while retaining "-Wconversion"?
>
void f(const unsigned char b)
{
unsigned char c = b & (unsigned char) 0xff;
}
manu@localhost:~/personal/gcc/objdir$ gcc/cc1plus -Wconversion test.C
void f(unsigned char)
test.C:3: warning: conversion to 'unsigned char' from 'int' may alter its value
test.C:3: warning: conversion to 'unsigned char' from 'int' may alter its value
There is something odd going on, so please open a bug report and add
manu@gcc.gnu.org to the CC list.
Thanks,
Manuel.