From patchwork Tue Aug 2 18:07:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 107983 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 08D40B71C5 for ; Wed, 3 Aug 2011 04:07:36 +1000 (EST) Received: (qmail 23169 invoked by alias); 2 Aug 2011 18:07:34 -0000 Received: (qmail 23157 invoked by uid 22791); 2 Aug 2011 18:07:33 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 02 Aug 2011 18:07:19 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p72I7Jox023591 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 2 Aug 2011 14:07:19 -0400 Received: from host1.jankratochvil.net (ovpn-116-16.ams2.redhat.com [10.36.116.16]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p72I7H57028204 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 2 Aug 2011 14:07:19 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p72I7GQ3030000 for ; Tue, 2 Aug 2011 20:07:16 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p72I7FbO029999 for gcc-patches@gcc.gnu.org; Tue, 2 Aug 2011 20:07:15 +0200 Date: Tue, 2 Aug 2011 20:07:15 +0200 From: Jan Kratochvil To: gcc-patches@gcc.gnu.org Subject: ping: [patch] libiberty/cp-demangle.c: Fix CP_DEMANGLE_DEBUG SIGSEGV Message-ID: <20110802180715.GA28777@host1.jankratochvil.net> References: <20110628201504.GA8860@host1.jankratochvil.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110628201504.GA8860@host1.jankratochvil.net> User-Agent: Mutt/1.5.21 (2010-09-15) 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 ping: On Tue, 28 Jun 2011 22:15:04 +0200, Jan Kratochvil wrote: Hi, a mechanical patch which fixes during #define CP_DEMANGLE_DEBUG make check -> /bin/sh: line 1: 9179 Segmentation fault ./test-demangle < ./demangle-expected which also fixes confusing output for _Z1hI1AIiEdEDTcldtfp_1gIT0_EEET_S2_ binary operator arguments binary operator operator . binary operator arguments ???---> template name 'g' template argument list template parameter 1 argument list Thanks, Jan libiberty/ 2011-06-28 Jan Kratochvil * cp-demangle.c (d_dump): Add " (zero-based)" to DEMANGLE_COMPONENT_TEMPLATE_PARAM. Implement DEMANGLE_COMPONENT_FUNCTION_PARAM, DEMANGLE_COMPONENT_VECTOR_TYPE, DEMANGLE_COMPONENT_NUMBER, DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS, DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS, DEMANGLE_COMPONENT_LAMBDA, DEMANGLE_COMPONENT_DEFAULT_ARG and DEMANGLE_COMPONENT_UNNAMED_TYPE. Print "??? %d" on unknown dc->type. --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -506,7 +507,10 @@ d_dump (struct demangle_component *dc, int indent) printf ("name '%.*s'\n", dc->u.s_name.len, dc->u.s_name.s); return; case DEMANGLE_COMPONENT_TEMPLATE_PARAM: - printf ("template parameter %ld\n", dc->u.s_number.number); + printf ("template parameter %ld (zero-based)\n", dc->u.s_number.number); + return; + case DEMANGLE_COMPONENT_FUNCTION_PARAM: + printf ("function parameter %ld (zero-based)\n", dc->u.s_number.number); return; case DEMANGLE_COMPONENT_CTOR: printf ("constructor %d\n", (int) dc->u.s_ctor.kind); @@ -633,6 +637,9 @@ d_dump (struct demangle_component *dc, int indent) case DEMANGLE_COMPONENT_FIXED_TYPE: printf ("fixed-point type\n"); break; + case DEMANGLE_COMPONENT_VECTOR_TYPE: + printf ("vector type\n"); + break; case DEMANGLE_COMPONENT_ARGLIST: printf ("argument list\n"); break; @@ -675,12 +682,35 @@ d_dump (struct demangle_component *dc, int indent) case DEMANGLE_COMPONENT_CHARACTER: printf ("character '%c'\n", dc->u.s_character.character); return; + case DEMANGLE_COMPONENT_NUMBER: + printf ("number %ld\n", dc->u.s_number.number); + return; case DEMANGLE_COMPONENT_DECLTYPE: printf ("decltype\n"); break; + case DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS: + printf ("global constructors keyed to name\n"); + break; + case DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS: + printf ("global destructors keyed to name\n"); + break; + case DEMANGLE_COMPONENT_LAMBDA: + printf ("lambda %d (zero-based)\n", dc->u.s_unary_num.num); + d_dump (dc->u.s_unary_num.sub, indent + 2); + return; + case DEMANGLE_COMPONENT_DEFAULT_ARG: + printf ("default argument %d (zero-based)\n", dc->u.s_unary_num.num); + d_dump (dc->u.s_unary_num.sub, indent + 2); + return; + case DEMANGLE_COMPONENT_UNNAMED_TYPE: + printf ("unnamed type %ld\n", dc->u.s_number.number); + return; case DEMANGLE_COMPONENT_PACK_EXPANSION: printf ("pack expansion\n"); break; + default: + printf ("??? %d\n", dc->type); + break; } d_dump (d_left (dc), indent + 2);