From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3794 invoked by alias); 2 May 2006 19:44:06 -0000 Received: (qmail 3762 invoked by alias); 2 May 2006 19:44:02 -0000 Date: Tue, 02 May 2006 19:44:00 -0000 Message-ID: <20060502194402.3761.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/27364] [4.1/4.2 Regression] VRP miscompiles some unsigned math In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "law at redhat dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-05/txt/msg00215.txt.bz2 List-Id: ------- Comment #14 from law at redhat dot com 2006-05-02 19:44 ------- Subject: Re: [4.2 Regression] Gcc 4.2 miscompiles binutils On Sun, 2006-04-30 at 18:21 +0000, pinskia at gcc dot gnu dot org wrote: > > ------- Comment #10 from pinskia at gcc dot gnu dot org 2006-04-30 18:21 ------- > Here is the reduced testcase: > int f(unsigned number_of_digits_to_use) > { > if (number_of_digits_to_use >1294) > return 0; > return (number_of_digits_to_use * 3321928 / 1000000 + 1) /16; > } > > int main(void) > { > if (f(11) != 2) > __builtin_abort (); As discussed in the PR, the problem is we don't detect overflow from MULT_EXPR correctly. This causes us to get an incorrect range which ultimately cascades into generating the wrong return value. This patch fixes the overflow detection for MULT_EXPR. Bootstrapped and regression tested on i686-pc-linux-gnu, both on the 4.1 branch and mainline. ------- Comment #15 from law at redhat dot com 2006-05-02 19:44 ------- Created an attachment (id=11362) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11362&action=view) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27364