From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12845 invoked by alias); 30 Nov 2014 20:57:26 -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 12821 invoked by uid 48); 30 Nov 2014 20:57:20 -0000 From: "andi-gcc at firstfloor dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/64130] vrp: handle non zero constant divided by range cannot be zero. Date: Sun, 30 Nov 2014 20:57: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: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: andi-gcc at firstfloor dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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-11/txt/msg03459.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64130 --- Comment #3 from Andi Kleen --- You're right. I actually meant x >= maxval(typeof(a)), x / a cannot be 0. Corrected test case (assuming 64bit target): #include int fsigned(int a) { return 0x1fffffffL / a == 0; } int funsigned(unsigned a) { return 0x1fffffffL / a == 0; } >So this should be optimized to a > 100 instead. Yes this would make sense too.