From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32040 invoked by alias); 2 Jan 2012 13:03:57 -0000 Received: (qmail 32026 invoked by uid 22791); 2 Jan 2012 13:03:56 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_LC,TW_XL X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 Jan 2012 13:03:41 +0000 From: "joseph at codesourcery dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/51730] [4.7 Regression] autoconf 2.60 through 2.67 stdbool.h check fails with GCC 4.7 Date: Mon, 02 Jan 2012 13:03:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: joseph at codesourcery dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.7.0 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2012-01/txt/msg00105.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51730 --- Comment #2 from joseph at codesourcery dot com 2012-01-02 13:03:35 UTC --- On Mon, 2 Jan 2012, jakub at gcc dot gnu.org wrote: > char digs[] = "0123456789"; > int xlcbug = 1 / (&(digs + 5)[-2 + (_Bool) 1] == &digs[4] ? 1 : -1); > check. Until http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172958 > GCC has been accepting this though, and I suppose we don't want to fold array > refs that way when generating code. Would it be possible to fold it that way > (try harder) just when we know we are not going to generate code based on it > (or when we know we'd error out otherwise)? I know it sounds like an ugly As I understand it, the point of that commit was that the conversion of all array references to pointer arithmetic (losing all information about signs of indices) was problematic. But it should still be valid to fold a comparison that way: if the addresses being compared have the same base object and all offsets are constant integers, a final byte offset for each address can be computed mod the size of the address space and it's OK to fold based on comparing those offsets (if the actual, signed offsets involved overflow anywhere, that would have been execution-time undefined behavior). That is, I think it would be better to fix this by improving the folding of address comparisons, rather than by changing how array references are expanded.