From patchwork Mon Nov 4 09:12:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 288135 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1AF682C007C for ; Mon, 4 Nov 2013 20:14:16 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=QhBZQdlkDyRmx+kLLXE4YnUeBmXXd1jnDviCjH48JyE/lE+M3j rbKLbDMHWGy8YHXNtVG8QjJmMQ2IG2fAEl4mhhJa/hdgGtXSYTfVpgUOYsTkrGZ6 Z7CFRIctzIPxhRPQEsp310XDltU/obz/DoxlbxaOqfT9CNdKqMUtTk+Qc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type; s= default; bh=4o19rZWo7UkIH+nGyXgTre/YQdI=; b=kCOBZmhhzY0f3L/R/M9o oTGlPFHZ5s2Q3LZXOxZiSZSUkGidIJrv/u31d3DrLgHIvi4fsIhj1yj1WVU3fKHm QVOTvtq+gUNchvS7Pt7SmawhkTfIP4dalXTV4ZhfvFnHIWeYW9q/EPgUuey3P5Yr nGfnm23tD8JBFEry1klznD8= Received: (qmail 28928 invoked by alias); 4 Nov 2013 09:14:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 28891 invoked by uid 89); 4 Nov 2013 09:14:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RDNS_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mail-wi0-f170.google.com Received: from Unknown (HELO mail-wi0-f170.google.com) (209.85.212.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 04 Nov 2013 09:12:45 +0000 Received: by mail-wi0-f170.google.com with SMTP id ex4so1614684wid.1 for ; Mon, 04 Nov 2013 01:12:36 -0800 (PST) X-Received: by 10.180.12.14 with SMTP id u14mr11370212wib.63.1383556356112; Mon, 04 Nov 2013 01:12:36 -0800 (PST) Received: from localhost ([2.28.235.51]) by mx.google.com with ESMTPSA id dn2sm1943884wid.1.2013.11.04.01.12.35 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Mon, 04 Nov 2013 01:12:35 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, Kenneth Zadeck , mikestump@comcast.net, rdsandiford@googlemail.com Cc: Kenneth Zadeck , mikestump@comcast.net Subject: [wide-int] Make integer_onep return false for signed 1-bit bitfields Date: Mon, 04 Nov 2013 09:12:35 +0000 Message-ID: <87li14h6nw.fsf@talisman.default> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 As discussed on gcc@, integer_onep is supposed to return false for a nonzero 1-bit value if the type is signed. Tested on x86_64-linux-gnu and powerpc64-linux-gnu. OK to install? Thanks, Richard Index: gcc/tree.c =================================================================== --- gcc/tree.c 2013-10-29 19:19:27.623468618 +0000 +++ gcc/tree.c 2013-11-02 17:25:06.499657501 +0000 @@ -2092,7 +2092,7 @@ integer_onep (const_tree expr) switch (TREE_CODE (expr)) { case INTEGER_CST: - return wi::eq_p (expr, 1); + return wi::eq_p (wi::to_widest (expr), 1); case COMPLEX_CST: return (integer_onep (TREE_REALPART (expr)) && integer_zerop (TREE_IMAGPART (expr)));