From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6250 invoked by alias); 1 Jul 2005 01:40:47 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 6220 invoked by uid 22791); 1 Jul 2005 01:40:38 -0000 Received: from smtp-105-friday.nerim.net (HELO kraid.nerim.net) (62.4.16.105) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 01 Jul 2005 01:40:38 +0000 Received: from uniton.integrable-solutions.net (gdr.net1.nerim.net [62.212.99.186]) by kraid.nerim.net (Postfix) with ESMTP id 49D0540E31; Fri, 1 Jul 2005 03:40:34 +0200 (CEST) Received: from uniton.integrable-solutions.net (localhost [127.0.0.1]) by uniton.integrable-solutions.net (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id j611dlKY017913; Fri, 1 Jul 2005 03:39:47 +0200 Received: (from gdr@localhost) by uniton.integrable-solutions.net (8.12.10/8.12.10/Submit) id j611dlRL017912; Fri, 1 Jul 2005 03:39:47 +0200 To: Joe Buck Cc: Andrew Pinski , "'gcc mailing list'" Subject: Re: Should GCC publish a general rule/warning due to it's default presumption of undefined signed integer overflow semantics? References: <20050630220250.GA10768@synopsys.com> <20050630232531.GA11010@synopsys.com> <20050701012538.GA11465@synopsys.com> From: Gabriel Dos Reis In-Reply-To: <20050701012538.GA11465@synopsys.com> Date: Fri, 01 Jul 2005 01:40:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2005-07/txt/msg00011.txt.bz2 Joe Buck writes: | On Thu, Jun 30, 2005 at 09:02:48PM -0400, Andrew Pinski wrote: | > But the reason question is why make it an undefined behavior instead of | > an implementation defined? This would have made it clearer instead of | > allowing the compiler not document what happens. Or is C++ | > just following C here? In which case it might be better to ask the C | > committee why it was done this way and real definition of undefined for | > this case? | | I already showed you the answer: loop optimization works better if you | can ignore overflow. There are various ways to work within "loop optimization" assumptions. Assuming undefined behaviour is not the only one. In fact, given the fact that the natural integer type for indices is "int" and not "unsigned" and the known dislike of the original implementer of C++ for "unsigned", it is legitimate to question whether that is "the answer". I think that can be an "a posteriori" justification, but I'm not sure that is "the answer". -- Gaby