This is the mail archive of the gcc-bugs@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]

[Bug c++/11492] Unsigned char promoted to signed int in for loop test for gpp but not gcc


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From jsm at polyomino dot org dot uk  2003-07-10 21:01 -------
Subject: Re:  Unsigned char promoted to signed int in for loop
 test for gpp but not gcc

On Thu, 10 Jul 2003, bangerth at dealii dot org wrote:

> "1000" is a signed integer constant, so b*1000 is a signed integer too. I
> guess the warning is ok, then.

To be useful, these warnings are meant to be smart - not warning if it can
be proved that the signed value is nonnegative (tree_expr_nonnegative_p).
Knowing that, for b an unsigned char, b * 1000 is nonnegative, is
something that GCC reasonably could do, and similar to some cases Roger
Sayle has made GCC handle.


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