This is the mail archive of the
mailing list for the GCC project.
[Bug middle-end/11492] Unsigned char promoted to signed int in for loop test for gpp but not gcc
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Nov 2005 16:19:23 -0000
- Subject: [Bug middle-end/11492] Unsigned char promoted to signed int in for loop test for gpp but not gcc
- References: <firstname.lastname@example.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from pinskia at gcc dot gnu dot org 2005-11-15 16:19 -------
(In reply to comment #1)
> "1000" is a signed integer constant, so b*1000 is a signed integer too. I
> guess the warning is ok, then.
That is only true for unsigned multiplication and signed when overflow is
undefined (-fno-wrapv which is default for C and C++).
The reason why this is middle-end and not C is because tree_expr_nonnegative_p
is part of the middle-end and not part of the C front-end. Fixing
tree_expr_nonnegative_p will also provide some optimization opertunites also.