This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -Wconversion bug in g++-4.3?


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]