From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2986 invoked by alias); 5 Jul 2007 19:02:45 -0000 Received: (qmail 2945 invoked by uid 48); 5 Jul 2007 19:02:23 -0000 Date: Thu, 05 Jul 2007 19:02:00 -0000 Message-ID: <20070705190223.2944.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/32628] [4.3 Regression] bogus integer overflow warning In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pinskia at gcc dot gnu dot org" 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-07/txt/msg00682.txt.bz2 ------- Comment #2 from pinskia at gcc dot gnu dot org 2007-07-05 19:02 ------- This patch works for me: Index: fold-const.c =================================================================== --- fold-const.c (revision 126338) +++ fold-const.c (working copy) @@ -282,14 +282,8 @@ HOST_WIDE_INT high, int overflowable, bool overflowed) { - int sign_extended_type; bool overflow; - /* Size types *are* sign extended. */ - sign_extended_type = (!TYPE_UNSIGNED (type) - || (TREE_CODE (type) == INTEGER_TYPE - && TYPE_IS_SIZETYPE (type))); - overflow = fit_double_type (low, high, &low, &high, type); /* If we need to set overflow flags, return a new unshared node. */ @@ -297,7 +291,7 @@ { if (overflowed || overflowable < 0 - || (overflowable > 0 && sign_extended_type)) + || (overflowable > 0 && !TYPE_UNSIGNED (type))) { tree t = make_node (INTEGER_CST); TREE_INT_CST_LOW (t) = low; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32628