From patchwork Sun Nov 13 17:37:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 81962 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp679989qge; Sun, 13 Nov 2016 09:38:31 -0800 (PST) X-Received: by 10.99.147.78 with SMTP id w14mr8059387pgm.144.1479058711720; Sun, 13 Nov 2016 09:38:31 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id o2si16036035pax.59.2016.11.13.09.38.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Nov 2016 09:38:31 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-441251-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-441251-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-441251-patch=linaro.org@gcc.gnu.org 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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=gb2nM8glnW1TFqfT vmXxgXWXT7eB0oElBaeKAJ7EuXxMirY3OWaDseLDRAscB50xq20AGavbeRhPV2Sh KyhpBG5Utn6nbzMZD01YpOVdV423Zs5TCAyew6OmExc5vDapsE2N2wPs1NjnoLJX 2//ntjWCx7zNuAiADuwbEBXS21Q= 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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=LdI2Nn6Hv+5a2wRtqt/oZy lPeEA=; b=eTfRaqXUvkrEt/J8kp0iC1GtV3k/ZzyHauCaiGPAxh48EzT7HIgB2m m/Y3PNJHJNVnNmF5T8BUczeQ2fdwaDt5ofyr8HNvgvCRKQqTz4UO5JIhmyhZvtf6 sE2btTlhyr7NBBphWVBpgLKoaAZrAvGGwewrXFR4BLdpS8QXVnaYA= Received: (qmail 70684 invoked by alias); 13 Nov 2016 17:38:11 -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 70668 invoked by uid 89); 13 Nov 2016 17:38:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1349 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 13 Nov 2016 17:38:00 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 4696E812EC for ; Sun, 13 Nov 2016 18:37:58 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DrGQHeZHyEL1 for ; Sun, 13 Nov 2016 18:37:58 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 212B2812EB for ; Sun, 13 Nov 2016 18:37:58 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Fix segfault on double typedef for enum with -fdump-ada-spec Date: Sun, 13 Nov 2016 18:37:57 +0100 Message-ID: <54782229.rgNBnXcqE2@polaris> User-Agent: KMail/4.14.10 (Linux/3.16.7-48-desktop; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 This happens with the C++ compiler only. Tested on x86_64-suse-linux, applied on the mainline. 2016-11-13 Eric Botcazou c-family/ * c-ada-spec.c (print_ada_declaration): For typedef declarations, look for nested types only if the type is a record or union and dump SLOC. 2016-11-13 Eric Botcazou * c-c++-common/dump-ada-spec-6.c: New test. -- Eric Botcazou Index: c-ada-spec.c =================================================================== --- c-ada-spec.c (revision 242334) +++ c-ada-spec.c (working copy) @@ -2813,7 +2813,7 @@ print_ada_declaration (pretty_printer *b } else { - if (!TREE_VISITED (stub) + if (RECORD_OR_UNION_TYPE_P (typ) && DECL_SOURCE_FILE (stub) == source_file_base) dump_nested_types (buffer, stub, stub, true, spc); @@ -2821,7 +2821,8 @@ print_ada_declaration (pretty_printer *b dump_generic_ada_node (buffer, t, type, spc, false, true); pp_string (buffer, " is "); dump_generic_ada_node (buffer, typ, type, spc, false, true); - pp_semicolon (buffer); + pp_string (buffer, "; -- "); + dump_sloc (buffer, t); } TREE_VISITED (t) = 1;