From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18522 invoked by alias); 2 Dec 2010 09:09:02 -0000 Received: (qmail 18506 invoked by uid 22791); 2 Dec 2010 09:09:01 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_SV 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; Thu, 02 Dec 2010 09:08:57 +0000 From: "jay.krell at cornell dot edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/46679] fold_binary changes types in divisionm breaking configure -enable-checking X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jay.krell at cornell dot edu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Version 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 Date: Thu, 02 Dec 2010 09:09:00 -0000 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: 2010-12/txt/msg00150.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46679 Jay changed: What |Removed |Added ---------------------------------------------------------------------------- Version|4.5.1 |4.6.0 --- Comment #1 from Jay 2010-12-02 09:08:49 UTC --- You can "prove", almost, the existance of the bug by making this change to slightly increase it: jbook2:gcc jay$ svn diff fold-const.c Index: fold-const.c =================================================================== --- fold-const.c (revision 167194) +++ fold-const.c (working copy) @@ -11648,7 +11648,7 @@ Note that only CEIL_DIV_EXPR and FLOOR_DIV_EXPR are rewritten now. At one time others generated faster code, it's not clear if they do after the last round to changes to the DIV code in expmed.c. */ - if ((code == CEIL_DIV_EXPR || code == FLOOR_DIV_EXPR) + if ((code == CEIL_DIV_EXPR || code == TRUNC_DIV_EXPR || code == FLOOR_DIV_EXPR) && multiple_of_p (type, arg0, arg1)) return fold_build2_loc (loc, EXACT_DIV_EXPR, type, arg0, arg1); it: I don't think C ever produces ceil_div/floor_div, so it's hard to demonstrate. With this, bootstrap fails: /src/gcc-trunk/configure -prefix=/usr/local/gcc-trunk -enable-checking=assert,df,fold,misc,rtl,rtlflag,runtime,tree,types && make -j4 /src/gcc-trunk/gcc/tree-ssa-loop-prefetch.c:1503:1: error: type mismatch in binary expression unsigned int int unsigned int D.55547 = D.55546 /[ex] 16; other than just removing this chunk of code completely, I might suggest checking that arg0 == op0 && arg1 == op1. Though that is probably a bit more conservative than necessary.