[Bug c++/20019] incorrect overflow warning

2007-01-12 Thread manu at gcc dot gnu dot org
--- Comment #12 from manu at gcc dot gnu dot org 2007-01-13 02:23 --- There is no warning with GCC 4.3 and you can get a warning for the int->char conversion by using -Wconversion. So I am going to close this. Please, feel free to reopen if you think there is some unresolved issue. --

[Bug c++/20019] incorrect overflow warning

2006-11-25 Thread manu at gcc dot gnu dot org
--- Comment #11 from manu at gcc dot gnu dot org 2006-11-25 13:51 --- I don't get the warning with current mainline (revision 119143). Still, I would like to keep this bug around since it may be interesting that Wconversion emits a warning for the int->char conversion. I would like to h

[Bug c++/20019] incorrect overflow warning

2005-02-17 Thread neil at daikokuya dot co dot uk
--- Additional Comments From neil at daikokuya dot co dot uk 2005-02-17 15:12 --- Subject: Re: incorrect overflow warning schlie at comcast dot net wrote:- > > --- Additional Comments From schlie at comcast dot net 2005-02-17 14:33 > --- > (In reply to comment #8) > > char

[Bug c++/20019] incorrect overflow warning

2005-02-17 Thread schlie at comcast dot net
--- Additional Comments From schlie at comcast dot net 2005-02-17 14:33 --- (In reply to comment #8) > char x = 0x80; warning: value changes sign during integer type conversion Implying an analogous warning for all assignments between dissimilarly signed variables (i.e. signed x; unsign

[Bug c++/20019] incorrect overflow warning

2005-02-17 Thread neil at daikokuya dot co dot uk
--- Additional Comments From neil at daikokuya dot co dot uk 2005-02-17 14:00 --- Subject: Re: incorrect overflow warning schlie at comcast dot net wrote:- > > --- Additional Comments From schlie at comcast dot net 2005-02-17 13:20 > --- > (In reply to comment #6) > > What

[Bug c++/20019] incorrect overflow warning

2005-02-17 Thread schlie at comcast dot net
--- Additional Comments From schlie at comcast dot net 2005-02-17 13:20 --- (In reply to comment #6) > What should get a warning is the assignment of 0x80 to a char. Not that either, as although the two differ in sign, the value does not exceed the type's precision. -- http://gcc.

[Bug c++/20019] incorrect overflow warning

2005-02-17 Thread neil at daikokuya dot co dot uk
--- Additional Comments From neil at daikokuya dot co dot uk 2005-02-17 11:34 --- Subject: Re: incorrect overflow warning pinskia at gcc dot gnu dot org wrote:- > > --- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-17 > 03:14 --- > No the warning is correc

[Bug c++/20019] incorrect overflow warning

2005-02-16 Thread igodard at pacbell dot net
--- Additional Comments From igodard at pacbell dot net 2005-02-17 04:10 --- Please: yes, the int value lwbi arising from the conversion of char(0x80) is the int value 0xff80, i.e. int(-128); you are quite right about that. That value is being *subtracted* from the int value upbi

[Bug c++/20019] incorrect overflow warning

2005-02-16 Thread pinskia at gcc dot gnu dot org
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-17 03:43 --- static const int lwbi = lwb; lwb = 0x80 lwbi is the signed extended version of lwb to the size of int so you will still get 0xFF80. So this is still not a bug. -- What|Removed

[Bug c++/20019] incorrect overflow warning

2005-02-16 Thread igodard at pacbell dot net
--- Additional Comments From igodard at pacbell dot net 2005-02-17 03:37 --- WADR, but "char" on my (x86 Linux) machine in fact signed. So I tried: #include static const char lwb = 0x80; static const char upb = 0x7f; static const int lwbi = lwb; static const int upbi = upb; static cons

[Bug c++/20019] incorrect overflow warning

2005-02-16 Thread pinskia at gcc dot gnu dot org
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-17 03:14 --- No the warning is correct as char on a lot of targets is signed by default so promoting (char)0x80 to int will give 0xFF80. -- What|Removed |Added -

[Bug c++/20019] incorrect overflow warning

2005-02-16 Thread igodard at pacbell dot net
--- Additional Comments From igodard at pacbell dot net 2005-02-17 03:09 --- Turns out that the promotion rules aren't the problem, because you still get the same message even with *explicit* promotion - the code: #include static const char lwb = 0x80; static const char upb = 0x7f; st