From patchwork Mon Jan 16 17:12:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 136327 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]) by ozlabs.org (Postfix) with SMTP id 078EF1007D3 for ; Tue, 17 Jan 2012 04:21:23 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1327339284; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Message-ID:Date:From:User-Agent:MIME-Version: To:CC:Subject:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=YNKBV4jGrtENu3s+yYz32ab/eTo=; b=wxNAPrBt0H+qiXK LbRKVL55eEhkoB/0Ejtt9yb/q+nd7qfLM95GH3z1B2QqpFxjsFtKtSAxwb4/NOP1 61BC6swazdTCVn1ipH6jB2kjGi3sQxP8nqceMFroTH0XoERyeGM5gH1DhoAoB4xj iblj9gObgkRah6/FipFfUxQEB8Bk= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=sLaz1KtKh9SgzFlMZ94l2OUo7C8hrJ7GJ17soR44T4qPtMQdF1mbEIUi/+Gi7n /obG1nOHJW8+9kEn60lBlD5advWwHJ8NuQXR+g2I4urvqf58LDl8wrSQ1qp0QvGA 1txL0o1Ym0DiCd6AmP4SPJKJd9dCdkryOEaYzG9vRZa94=; Received: (qmail 10744 invoked by alias); 16 Jan 2012 17:21:18 -0000 Received: (qmail 10734 invoked by uid 22791); 16 Jan 2012 17:21:17 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from acsinet15.oracle.com (HELO acsinet15.oracle.com) (141.146.126.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 16 Jan 2012 17:21:05 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id q0GHIkKa006277 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 16 Jan 2012 17:21:03 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q0GHDRTs016422 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 16 Jan 2012 17:13:28 GMT Received: from abhmt116.oracle.com (abhmt116.oracle.com [141.146.116.68]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q0GHDRUY017874; Mon, 16 Jan 2012 11:13:27 -0600 Received: from [192.168.1.4] (/79.56.218.247) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 16 Jan 2012 09:13:27 -0800 Message-ID: <4F145A6A.2080702@oracle.com> Date: Mon, 16 Jan 2012 18:12:10 +0100 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111219 Thunderbird/9.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 51777 X-IsSubscribed: yes 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 Hi, in this diagnostic issue we incorrectly print unsigned template arguments as signed. The fix seems straightforward: just use the very same algorithm used in dump_generic_node for INTEGER_CST, thus dispatch to either pp_wide_integer or pp_unsigned_wide_integer. Booted and tested C++ (testing in progress for C etc.) Ok for mainline? Thanks, Paolo. /////////////////////// 2012-01-16 Paolo Carlini PR c++/51777 * c-pretty-print.c (pp_c_integer_constant): For unsigned constants use pp_unsigned_wide_integer. Index: c-pretty-print.c =================================================================== --- c-pretty-print.c (revision 183211) +++ c-pretty-print.c (working copy) @@ -910,8 +910,10 @@ pp_c_integer_constant (c_pretty_printer *pp, tree ? TYPE_CANONICAL (TREE_TYPE (i)) : TREE_TYPE (i); - if (TREE_INT_CST_HIGH (i) == 0) + if (host_integerp (i, 0)) pp_wide_integer (pp, TREE_INT_CST_LOW (i)); + else if (host_integerp (i, 1)) + pp_unsigned_wide_integer (pp, TREE_INT_CST_LOW (i)); else { unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (i);