From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19202 invoked by alias); 28 Jun 2005 11:50:31 -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 18800 invoked by uid 22791); 28 Jun 2005 11:50:08 -0000 Received: from smtp-102-tuesday.nerim.net (HELO kraid.nerim.net) (62.4.16.102) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 28 Jun 2005 11:50:08 +0000 Received: from uniton.integrable-solutions.net (gdr.net1.nerim.net [62.212.99.186]) by kraid.nerim.net (Postfix) with ESMTP id E992D40E2D; Tue, 28 Jun 2005 13:50:05 +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 j5SBnTKY002902; Tue, 28 Jun 2005 13:49:29 +0200 Received: (from gdr@localhost) by uniton.integrable-solutions.net (8.12.10/8.12.10/Submit) id j5SBnTks002901; Tue, 28 Jun 2005 13:49:29 +0200 To: Robert Dewar Cc: Andrew Pinski , gcc mailing list Subject: Re: signed is undefined and has been since 1992 (in GCC) References: <27fdc0d8dc588cfdb3a14a153c5d037c@physics.uc.edu> <6d9fa260f233e519762c7d11276a35ad@physics.uc.edu> <3dbad9a6bd7eb1aea74ff2245eaa1b99@physics.uc.edu> <42C115D5.8070503@adacore.com> From: Gabriel Dos Reis In-Reply-To: <42C115D5.8070503@adacore.com> Date: Tue, 28 Jun 2005 11:50:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2005-06/txt/msg01092.txt.bz2 Robert Dewar writes: | Gabriel Dos Reis wrote: | | > and it should also be able to take your life. Do you want it to actually | > do it? If yes, I suggest you create your own compiler that does that | > and leave us work on a compiler that does something more positive. | > -- Gaby | | Obviously no one programs a compiler to deliberately have disastrous | behavior in an undefined situation. However, if you are interested in | the best possible code from an efficiency point of view, the compiler | is allowed to assert that the overflow cannot take place, and then make | all logical deductions about control flow etc that come from this | assumption. As I showed with my password example, this can have unexpected | results. I saw your passsword example but I think it is largely beside the point. I'm not interested in programming "undefined behaviour". I'm looking for way to take advantage of that liberty we accept more useful programs where we can. The issue here is whether if the hardware consistently display a semantics, GCC should not allow access to that consistent semantics under the name that "the standard says it is undefined behaviour". Consider the case of converting a void* to a F*, where F is a function type. -- Gaby