From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1021 invoked by alias); 11 Apr 2014 11:02:31 -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 Received: (qmail 961 invoked by uid 48); 11 Apr 2014 11:02:28 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/55022] [4.8/4.9 Regression] air.f90 is miscompliled with -m64 -O2 -fgraphite-identity after revision 190619 Date: Fri, 11 Apr 2014 11:02:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status assigned_to Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-04/txt/msg00808.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55022 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org --- Comment #18 from Richard Biener --- (In reply to Mircea Namolaru from comment #17) > Vladimir Kargov, Tobias Grosser and me found that the problem is caused by > incorrect folding of the floord operator. As a result Cloog translates the > expression > -4294967296*floord(_19-i_17,4294967296) > to the tree-SSA expression > 4294967296*floord(_19-i_17,-4294967296) > > This is wrong, in the first case floord is 0 and in the second is -1. Not sure where that "folding" happens or what "floord" is, but if you are refering to negate_expr () negating a /[fl] CST as a /[fl] -CST then yes, that looks suspicious. OTOH the division variant tree codes don't appear in the IL very often so it's hard to notice these mistakes. Testing Index: gcc/fold-const.c =================================================================== *** gcc/fold-const.c (revision 209292) --- gcc/fold-const.c (working copy) *************** negate_expr_p (tree t) *** 484,491 **** case TRUNC_DIV_EXPR: case ROUND_DIV_EXPR: - case FLOOR_DIV_EXPR: - case CEIL_DIV_EXPR: case EXACT_DIV_EXPR: /* In general we can't negate A / B, because if A is INT_MIN and B is 1, we may turn this into INT_MIN / -1 which is undefined --- 484,489 ---- *************** fold_negate_expr (location_t loc, tree t *** 682,689 **** case TRUNC_DIV_EXPR: case ROUND_DIV_EXPR: - case FLOOR_DIV_EXPR: - case CEIL_DIV_EXPR: case EXACT_DIV_EXPR: /* In general we can't negate A / B, because if A is INT_MIN and B is 1, we may turn this into INT_MIN / -1 which is undefined --- 680,685 ----