From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1657 invoked by alias); 23 Dec 2014 19:51:38 -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 1606 invoked by uid 48); 23 Dec 2014 19:51:34 -0000 From: "Joost.VandeVondele at mat dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/50865] Invalid code generation for INT64_MIN % 1 on x86_64 Date: Tue, 23 Dec 2014 19:51:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.5.3 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: Joost.VandeVondele at mat dot ethz.ch X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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-12/txt/msg02665.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50865 Joost VandeVondele changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Joost.VandeVondele at mat dot ethz | |.ch --- Comment #13 from Joost VandeVondele --- (In reply to Mikael Pettersson from comment #12) > Created attachment 34323 [details] > patch restricting the X % -Y -> X % Y transformation to when it's safe > > This proposed patch restricts the X % -Y -> X % Y transformation to cases > when we can be certain that it doesn't result in undefined behaviour, i.e. > when Y != 1 or X != INT_MIN. Passes bootstrap and testsuite on x86_64-linux > so far. Shouldn't disabling this be language dependent ? I.e. in Fortran this transformation is always valid (as integers in conforming programs are always in the symmetric range).