From patchwork Sun Oct 18 23:46:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Maltsev X-Patchwork-Id: 532065 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 66E9E1401F0 for ; Mon, 19 Oct 2015 10:47:14 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=S+9N0BeX; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=akj/WLwnpgD4fDj/3+wHPsqV2Luosyu/S3H4t1CZBzum66 s9T7zEJYyDfqGl+5MCNfKtpshZosCWGPV/gJKm2RDUJ67nv9SE9B2fDGd8gas4P+ 7NioM3smxNxfhztyyChh0IrEL/GYEeF9zU4TfsWwO5zBX/9jpru7wrkyt/FEU= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=KkeBsz6/5E43gruG/g0wiIe3Xhg=; b=S+9N0BeXGfLpTC3+TUTB mSnlHVmF2SqXINtKXSNgEpUbBOw/bxsCWCa9Na7A9hU1MYTGf6xpdVL08C6gfoAy 79JcyrVMJHGqofRLMFduPWQKv/reVOYPs2/HKWZVk+W3q96uBw8UZ4qCSKa2phmU tchayCEqaZ1M7mC62xiIvcQ= Received: (qmail 1514 invoked by alias); 18 Oct 2015 23:47:07 -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 1500 invoked by uid 89); 18 Oct 2015 23:47:06 -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, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 18 Oct 2015 23:47:05 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44735) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ZnxfL-0004Bx-EG for gcc-patches@gnu.org; Sun, 18 Oct 2015 19:47:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZnxfH-0005gi-LA for gcc-patches@gnu.org; Sun, 18 Oct 2015 19:47:02 -0400 Received: from mail-lb0-x233.google.com ([2a00:1450:4010:c04::233]:33174) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZnxfH-0005eS-DK for gcc-patches@gnu.org; Sun, 18 Oct 2015 19:46:59 -0400 Received: by lbbpp2 with SMTP id pp2so101937121lbb.0 for ; Sun, 18 Oct 2015 16:46:56 -0700 (PDT) X-Received: by 10.112.156.193 with SMTP id wg1mr12939150lbb.24.1445212016380; Sun, 18 Oct 2015 16:46:56 -0700 (PDT) Received: from [192.168.123.200] ([77.41.78.126]) by smtp.googlemail.com with ESMTPSA id wj8sm4769600lbb.44.2015.10.18.16.46.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Oct 2015 16:46:55 -0700 (PDT) Message-ID: <56242F6E.8030603@gmail.com> Date: Mon, 19 Oct 2015 02:46:54 +0300 From: Mikhail Maltsev User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 MIME-Version: 1.0 To: gcc-patches Subject: [PATCH, committed] PR other/65800. Fix crash in gengtype's internal debug debug dump X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::233 X-IsSubscribed: yes Hi! gengtype has an option '-d' which allows to dump it's internal state. I planned to use it in order to create some kind of list of all data which GCC stores in garbage-collected memory. Unfortunately this option was broken. The attached patch fixes it. Because it only affects gengtype's internal debugging option (and is also rather small), I think it's OK to commit it without approve (as obvious). Bootstrapped and regtested on x86_64-pc-linux-gnu. diff --git a/gcc/gengtype.c b/gcc/gengtype.c index 866d809..8c5c36d 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -4878,10 +4878,17 @@ dump_type (int indent, type_p t) { PTR *slot; + printf ("%*cType at %p: ", indent, ' ', (void *) t); + if (t->kind == TYPE_UNDEFINED) + { + gcc_assert (t->gc_used == GC_UNUSED); + printf ("undefined.\n"); + return; + } + if (seen_types == NULL) seen_types = htab_create (100, htab_hash_pointer, htab_eq_pointer, NULL); - printf ("%*cType at %p: ", indent, ' ', (void *) t); slot = htab_find_slot (seen_types, t, INSERT); if (*slot != NULL) {