From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5989 invoked by alias); 27 Nov 2010 00:47:04 -0000 Received: (qmail 5974 invoked by uid 22791); 27 Nov 2010 00:47:03 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 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; Sat, 27 Nov 2010 00:46:58 +0000 From: "jay.krell at cornell dot edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/46679] New: fold_binary changes types in divisionm breaking configure -enable-checking X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Sat, 27 Nov 2010 01: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-11/txt/msg03312.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46679 Summary: fold_binary changes types in divisionm breaking configure -enable-checking Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned@gcc.gnu.org ReportedBy: jay.krell@cornell.edu fold_binary seemingly changes the types of division inputs (but not the output), leading to configure -enable-checking to fail. My code is something like this (using a different frontend and slightly patched 4.5.1 but I don't think relevantly): long a; long F(void) { return a / a; } configure -enable-checking=fold,...: gcc-4.5 fold-const.c fold_binary_loc(code = FLOOR_DIV_EXPR, op0, op1, type all int_64 arg0, arg1 become word_64 (not op0, op1, but arg0, arg1) and then we end up here: if ((code == CEIL_DIV_EXPR || code == FLOOR_DIV_EXPR) && multiple_of_p (type, arg0, arg1)) return fold_build2_loc (loc, EXACT_DIV_EXPR, type, arg0, arg1); and then: error: type mismatch in binary expression int_64 word_64 word_64 D.1003 = D.1001 /[ex] D.1002; multiple_of_p is true because the operands are the same. (This would optimize to 1, unless the operands might be 0.) I'll see if I can reproduce with unpatched C 4.5.1 and trunk. - Jay