From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6972 invoked by alias); 1 May 2006 16:36:23 -0000 Received: (qmail 6953 invoked by uid 48); 1 May 2006 16:36:21 -0000 Date: Mon, 01 May 2006 16:36:00 -0000 Message-ID: <20060501163621.6952.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/msg00046.txt.bz2 List-Id: ------- Comment #13 from law at redhat dot com 2006-05-01 16:36 ------- The overflow check for multiplication is totally bogus. The right way to check for overflow of an integer multiplication is to use division. ie, given res = a * b; Divide res by a, if the result is less than b, then the multiplication overlowed. [ Note, assumes a != 0. ] In fact, any result other than "b" is bad. Anyway, once we muck up the overflow status of the multiplication we lose. Jeff -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27364