From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30024 invoked by alias); 4 Jan 2007 10:15:27 -0000 Received: (qmail 29960 invoked by uid 48); 4 Jan 2007 10:15:16 -0000 Date: Thu, 04 Jan 2007 10:15:00 -0000 Message-ID: <20070104101516.29959.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/30364] [4.1/4.2/4.3 Regression] Wrong variable ranges due to constant folding In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "guillaume dot melquiond at ens-lyon dot fr" 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 X-SW-Source: 2007-01/txt/msg00163.txt.bz2 ------- Comment #1 from guillaume dot melquiond at ens-lyon dot fr 2007-01-04 10:15 ------- Is it really a middle-end issue? It could also be seen as a front-end issue, as it does produce "a + b - 40", doesn't it? If the front-end had given "(a - 20) + (b - 20)" to the middle-end, then the correct ranges would have been computed. When adjusting the testcase in such a way, GCC does generate correct code: int f(int a, int b) { if (a > 0x7FFFFFF0) return 0; if (b > 0x7FFFFFF0) return 0; int d = a - 20; int e = b - 20; int c = d + e; return c > 0x7FFFFFF0; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30364