* -Wconversion bug in g++-4.3?
@ 2007-11-19 20:11 Tom Browder
0 siblings, 0 replies; 5+ messages in thread
From: Tom Browder @ 2007-11-19 20:11 UTC (permalink / raw)
To: gcc-help
Consider the following code:
void f(const unsigned char b)
{
}
--
Tom Browder
Niceville, Florida
USA
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: -Wconversion bug in g++-4.3?
2007-11-23 13:56 ` Manuel López-Ibáñez
@ 2007-11-23 16:42 ` Andrew Haley
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Haley @ 2007-11-23 16:42 UTC (permalink / raw)
To: Manuel López-Ibáñez; +Cc: Tom Browder, gcc-help
Manuel López-Ibáñez writes:
> On 23/11/2007, Andrew Haley <aph@redhat.com> wrote:
> >
> > Please read http://gcc.gnu.org/wiki/NewWconversion. Please come back
> > if you have any further questions.
> >
>
> Funny. I wrote that page (my name is on the top) and I implemented
> that feature. This is a bug that we are discussing:
> http://gcc.gnu.org/PR34198. I guess you missed this:
> http://gcc.gnu.org/ml/gcc/2007-11/msg00577.html
LOL! Oops, sorry. :-)
Andrew.
--
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: -Wconversion bug in g++-4.3?
2007-11-23 10:24 ` Andrew Haley
@ 2007-11-23 13:56 ` Manuel López-Ibáñez
2007-11-23 16:42 ` Andrew Haley
0 siblings, 1 reply; 5+ messages in thread
From: Manuel López-Ibáñez @ 2007-11-23 13:56 UTC (permalink / raw)
To: Andrew Haley; +Cc: Tom Browder, gcc-help
On 23/11/2007, Andrew Haley <aph@redhat.com> wrote:
>
> Please read http://gcc.gnu.org/wiki/NewWconversion. Please come back
> if you have any further questions.
>
Funny. I wrote that page (my name is on the top) and I implemented
that feature. This is a bug that we are discussing:
http://gcc.gnu.org/PR34198. I guess you missed this:
http://gcc.gnu.org/ml/gcc/2007-11/msg00577.html
Cheers,
Manuel.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: -Wconversion bug in g++-4.3?
[not found] ` <6c33472e0711221502q54e9288ey7c30c9c96d3f72a1@mail.gmail.com>
@ 2007-11-23 10:24 ` Andrew Haley
2007-11-23 13:56 ` Manuel López-Ibáñez
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Haley @ 2007-11-23 10:24 UTC (permalink / raw)
To: Manuel López-Ibáñez; +Cc: Tom Browder, gcc-help
Manuel López-Ibáñez writes:
> For this testcase:
>
> void g(const unsigned char b)
> {
> unsigned short c = b & 0xff;
> }
>
> we get:
>
> wconversion-3.c:3: warning: conversion to 'unsigned char' from 'int'
> may alter its value
> wconversion-3.c:3: warning: conversion to 'short unsigned int' from
> 'int' may alter its value
>
> Really weird... It is the same in both C and C++.
Please read http://gcc.gnu.org/wiki/NewWconversion. Please come back
if you have any further questions.
Andrew.
--
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903
^ permalink raw reply [flat|nested] 5+ messages in thread
* -Wconversion bug in g++-4.3?
@ 2007-11-20 6:55 Tom Browder
0 siblings, 0 replies; 5+ messages in thread
From: Tom Browder @ 2007-11-20 6:55 UTC (permalink / raw)
To: gcc-help
(Excuse the previous msg--lost control of the key board.)
Consider the following code:
f.cc ==>
void f(const unsigned char b)
{
unsigned char c = static_cast<unsigned char>(b & 0xff);
}
<== f.cc
Compile with g++ 4.1.2:
$ g++-4.3-20071109 -c f.c -Wconversion
$
Note no warnings.
Compile with g++ 4.3-20071109:
$ g++-4.3-20071109 -c f.c -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"?
Thanks.
-Tom
Tom Browder
Niceville, Florida
USA
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-11-23 13:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-19 20:11 -Wconversion bug in g++-4.3? Tom Browder
2007-11-20 6:55 Tom Browder
[not found] <8bc817ee0711220633t68c7f078udc507d902830860@mail.gmail.com>
[not found] ` <6c33472e0711220846s207f65c3o333d87a350a8f2fa@mail.gmail.com>
[not found] ` <6c33472e0711221502q54e9288ey7c30c9c96d3f72a1@mail.gmail.com>
2007-11-23 10:24 ` Andrew Haley
2007-11-23 13:56 ` Manuel López-Ibáñez
2007-11-23 16:42 ` Andrew Haley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).