This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11492] Unsigned char promoted to signed int in for loop test for gpp but not gcc
- From: "jsm at polyomino dot org dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Jul 2003 21:02:00 -0000
- Subject: [Bug c++/11492] Unsigned char promoted to signed int in for loop test for gpp but not gcc
- References: <20030710192814.11492.afonso@contronics.com.br>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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.