From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14819 invoked by alias); 22 Jan 2007 08:28:24 -0000 Received: (qmail 14779 invoked by uid 48); 22 Jan 2007 08:28:13 -0000 Date: Mon, 22 Jan 2007 08:28:00 -0000 Message-ID: <20070122082813.14778.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/11492] Unsigned char promoted to signed int in for loop test for gpp but not gcc In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "manu at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-01/txt/msg01801.txt.bz2 ------- Comment #6 from manu at gcc dot gnu dot org 2007-01-22 08:28 ------- (In reply to comment #5) > (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++). > But in the example shown, it is true always, since b == 2 at compile time. Can't we detect that? I know that there is no dataflow solving in the front-ends. But as you said, tree_expr_nonnegative_p is part of the middle-end. Perhaps we should have dataflow info at the front-end. It will make our warnings much smarter. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11492