From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5191 invoked by alias); 22 Oct 2006 15:12:52 -0000 Received: (qmail 5019 invoked by uid 48); 22 Oct 2006 15:12:41 -0000 Date: Sun, 22 Oct 2006 15:12:00 -0000 Message-ID: <20061022151241.5018.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/23666] Fold does not reduce C - ~a into a + (C+1) In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" 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-10/txt/msg01877.txt.bz2 List-Id: ------- Comment #10 from rguenth at gcc dot gnu dot org 2006-10-22 15:12 ------- With the patch for 23295 we get the behavior as noted in comment #7. This is due to negate_expr_p (correctly) containing case BIT_NOT_EXPR: return INTEGRAL_TYPE_P (type) && (TYPE_UNSIGNED (type) || (flag_wrapv && !flag_trapv)); as negating ~7ffffff will result in signed overflow which is undefined without flag_wrapv. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23666